SVN Commit by dpage: r4188 - trunk/pgadmin3/xtra/pgagent

From: svn(at)pgadmin(dot)org
To: pgadmin-hackers(at)postgresql(dot)org
Subject: SVN Commit by dpage: r4188 - trunk/pgadmin3/xtra/pgagent
Date: 2005-05-17 13:53:30
Message-ID: 200505171353.j4HDrU4N010946@developer.pgadmin.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 executes repeatedly 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

Browse pgadmin-hackers by date

  From Date Subject
Next Message svn 2005-05-17 13:54:23 SVN Commit by dpage: r4189 - in trunk/pgadmin3/xtra/pgagent: . include
Previous Message svn 2005-05-17 13:32:25 SVN Commit by dpage: r4187 - trunk/pgadmin3/xtra/pgagent