# HG changeset patch # User Sascha L. Teichmann # Date 1302707999 0 # Node ID 33b9cc23ac9b5b3bfe5daef441a4bbde0b90eb33 # Parent b35d32e507b610d0bc2641ba4cb21c72ab34a4e9 Granularity of ttls should be milliseconds and not microseconds. artifacts/trunk@1678 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b35d32e507b6 -r 33b9cc23ac9b ChangeLog --- a/ChangeLog Wed Apr 13 11:26:53 2011 +0000 +++ b/ChangeLog Wed Apr 13 15:19:59 2011 +0000 @@ -1,3 +1,10 @@ +2011-04-13 Sascha L. Teichmann + + * artifact-database/src/main/resources/sql/org-postgresql-driver.properties: + Internal granularity should be milliseconds and not microseconds. + + * artifact-database/src/main/resources/sql/org-h2-driver.properties: + Forget last commit. 2011-04-13 Sascha L. Teichmann Fix for flys/issue9 diff -r b35d32e507b6 -r 33b9cc23ac9b artifact-database/src/main/resources/sql/org-h2-driver.properties --- a/artifact-database/src/main/resources/sql/org-h2-driver.properties Wed Apr 13 11:26:53 2011 +0000 +++ b/artifact-database/src/main/resources/sql/org-h2-driver.properties Wed Apr 13 15:19:59 2011 +0000 @@ -15,10 +15,10 @@ AND id NOT IN ($LOCKED_IDS$) \ LIMIT 50 -artifacts.select.gid=SELECT id, factory, data FROM artifacts WHERE gid = ?::uuid \ +artifacts.select.gid=SELECT id, ttl, factory, data FROM artifacts WHERE gid = ?::uuid \ AND (ttl IS NULL \ OR (DATEDIFF('MILLISECOND', last_access, CURRENT_TIMESTAMP) <= ttl) \ - OR id IN (SELECT artifact_id FROM collection_items)) \ + OR id IN (SELECT artifact_id FROM collection_items)) artifacts.get.id=SELECT id FROM artifacts WHERE gid = ? diff -r b35d32e507b6 -r 33b9cc23ac9b artifact-database/src/main/resources/sql/org-postgresql-driver.properties --- a/artifact-database/src/main/resources/sql/org-postgresql-driver.properties Wed Apr 13 11:26:53 2011 +0000 +++ b/artifact-database/src/main/resources/sql/org-postgresql-driver.properties Wed Apr 13 15:19:59 2011 +0000 @@ -10,14 +10,14 @@ artifacts.touch=UPDATE artifacts SET last_access = CURRENT_TIMESTAMP WHERE id = ? artifacts.outdated=SELECT id, factory, data FROM artifacts WHERE ttl IS NOT NULL \ - AND CURRENT_TIMESTAMP - last_access > (ttl || ' microseconds')::interval \ + AND CURRENT_TIMESTAMP - last_access > (ttl || ' milliseconds')::interval \ AND id NOT IN (SELECT DISTINCT artifact_id FROM collection_items) \ AND id NOT IN ($LOCKED_IDS$) \ LIMIT 50 artifacts.select.gid=SELECT id, ttl, factory, data FROM artifacts WHERE gid = ?::uuid \ AND (ttl IS NULL \ - OR (CURRENT_TIMESTAMP - last_access <= (ttl || ' microseconds')::interval) \ + OR (CURRENT_TIMESTAMP - last_access <= (ttl || ' milliseconds')::interval) \ OR id IN (SELECT artifact_id FROM collection_items)) artifacts.get.id=SELECT id FROM artifacts WHERE gid = ?::uuid @@ -75,7 +75,7 @@ collection.item.outdate.artifact= \ UPDATE artifacts \ - SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \ + SET last_access = CURRENT_TIMESTAMP - '2 milliseconds'::interval, ttl = 1 \ WHERE id = ? AND \ NOT EXSITS \ (SELECT id FROM collection_items WHERE collection_id <> ? AND artifact_id = ?) @@ -94,7 +94,7 @@ INNER JOIN collection_items ci ON c.id = ci.collection_id \ INNER JOIN artifacts a ON ci.artifact_id = a.id \ WHERE c.ttl IS NOT NULL \ - AND CURRENT_TIMESTAMP - c.last_access > (c.ttl || ' microseconds')::interval \ + AND CURRENT_TIMESTAMP - c.last_access > (c.ttl || ' milliseconds')::interval \ AND a.id NOT IN ($LOCKED_IDS$) collections.touch.by.gid =\ @@ -145,14 +145,14 @@ artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?) outdate.artifacts.collection=UPDATE artifacts \ - SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \ + SET last_access = CURRENT_TIMESTAMP - '2 milliseconds'::interval, ttl = 1 \ WHERE id IN \ (SELECT artifact_id FROM collection_items \ WHERE collection_id = ? AND \ artifact_id NOT IN (SELECT DISTINCT artifact_id FROM collection_items WHERE collection_id <> ?)) outdate.artifacts.user=UPDATE artifacts \ - SET last_access = CURRENT_TIMESTAMP - '2 microseconds'::interval, ttl = 1 \ + SET last_access = CURRENT_TIMESTAMP - '2 milliseconds'::interval, ttl = 1 \ WHERE id IN \ (SELECT artifact_id FROM collection_items WHERE \ collection_id IN (SELECT id FROM collections WHERE owner_id = ?) \