diff artifact-database/src/main/resources/sql/org-postgresql-driver.properties @ 243:33b9cc23ac9b

Granularity of ttls should be milliseconds and not microseconds. artifacts/trunk@1678 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 13 Apr 2011 15:19:59 +0000
parents b35d32e507b6
children a2df2b48d2aa
line wrap: on
line diff
--- 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 = ?) \

http://dive4elements.wald.intevation.org