SVN Commit by dpage: r4188 - trunk/pgadmin3/xtra/pgagent - Mailing list pgadmin-hackers

From svn@pgadmin.org
Subject SVN Commit by dpage: r4188 - trunk/pgadmin3/xtra/pgagent
Date
Msg-id 200505171353.j4HDrU4N010946@developer.pgadmin.org
Whole thread Raw
List pgadmin-hackers
Author: dpage
Date: 2005-05-17 14:53:30 +0100 (Tue, 17 May 2005)
New Revision: 4188

Modified:
   trunk/pgadmin3/xtra/pgagent/pgagent.sql
Log:
Always caculate the next run time at least one minute in the future to prevent 'execution storms' where the job
executesrepeatedly for 1 minute at a time. 

Modified: trunk/pgadmin3/xtra/pgagent/pgagent.sql
===================================================================
--- trunk/pgadmin3/xtra/pgagent/pgagent.sql    2005-05-17 13:32:25 UTC (rev 4187)
+++ trunk/pgadmin3/xtra/pgagent/pgagent.sql    2005-05-17 13:53:30 UTC (rev 4188)
@@ -179,15 +179,14 @@
     IF jscend IS NOT NULL AND jscend < now() THEN RETURN NULL; END IF;

     -- Get the time to find the next run after. It will just be the later of
-    -- now() and the start date for the time being, however, we might want to
+    -- now() + 1m and the start date for the time being, however, we might want to
     -- do more complex things using this value in the future.
-    IF date_trunc(''MINUTE'', jscstart) > date_trunc(''MINUTE'', now()) THEN
+    IF date_trunc(''MINUTE'', jscstart) > date_trunc(''MINUTE'', (now() + ''1 Minute''::interval)) THEN
         runafter := date_trunc(''MINUTE'', jscstart);
     ELSE
-        runafter := date_trunc(''MINUTE'', now());
+        runafter := date_trunc(''MINUTE'', (now() + ''1 Minute''::interval));
     END IF;

-
     --
     -- Enter a loop, generating next run timestamps until we find one
     -- that falls on the required weekday, and is not matched by an exception


pgadmin-hackers by date:

Previous
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r4187 - trunk/pgadmin3/xtra/pgagent
Next
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r4189 - in trunk/pgadmin3/xtra/pgagent: . include