Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7e974b5

Browse files
author
Vladimir Ershov
committed
fix execution window, get_log SELECT + OUTER JOIN && bgworker_restart time
1 parent62b316b commit7e974b5

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

‎pgpro_scheduler--2.0.sql

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,12 @@ DECLARE
284284
cron_idINTEGER;
285285
BEGIN
286286
cron_id :=NEW.id;
287-
IF NOTNEW.activeORNEW.brokenORNEW.rule<>OLD.ruleORNEW.postpone<>OLD.postpone THEN
287+
IF NOTNEW.activeORNEW.brokenOR
288+
coalesce(NEW.rule<>OLD.rule, true)OR
289+
coalesce(NEW.postpone<>OLD.postpone, true)OR
290+
coalesce(NEW.start_date<>OLD.start_date, true)OR
291+
coalesce(NEW.end_date<>OLD.end_date, true)
292+
THEN
288293
DELETEFROM atWHERE cron= cron_idAND active= false;
289294
END IF;
290295
RETURN OLD;
@@ -1206,9 +1211,9 @@ BEGIN
12061211
END IF;
12071212

12081213
IF usename='___all___' THEN
1209-
sql_cmd :='SELECT * FROM log as l, cron as cronWHERE cron.id = l.cron';
1214+
sql_cmd :='SELECT * FROM log as lLEFT OUTER JOIN cronON cron.id = l.cron';
12101215
ELSE
1211-
sql_cmd :='SELECT * FROM log as l, cron as cronWHERE cron.executor ='''|| usename||''' AND cron.id = l.cron';
1216+
sql_cmd :='SELECT * FROM log as lLEFT OUTER JOIN cronON cron.executor ='''|| usename||''' AND cron.id = l.cron';
12121217
END IF;
12131218

12141219
FOR iiIN EXECUTE sql_cmd LOOP

‎src/pgpro_scheduler.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ pg_scheduler_startup(void)
408408
worker.bgw_flags=BGWORKER_SHMEM_ACCESS |
409409
BGWORKER_BACKEND_DATABASE_CONNECTION;
410410
worker.bgw_start_time=BgWorkerStart_ConsistentState;
411-
worker.bgw_restart_time=BGW_NEVER_RESTART;
411+
worker.bgw_restart_time=10;
412412
worker.bgw_main=NULL;
413413
worker.bgw_notify_pid=0;
414414
worker.bgw_main_arg=Int32GetDatum(0);

‎src/scheduler_manager.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ scheduler_task_t *scheduler_get_active_tasks(scheduler_manager_ctx_t *ctx, int *
378378

379379
*nt=0;
380380
initStringInfo(&sql);
381-
appendStringInfo(&sql,"select id, rule, postpone, _next_exec_time, next_time_statement from cron where active and not broken and (start_date <= 'now' or start_date is null) and (end_date<= 'now' or end_date is null) and node = '%s'",ctx->nodename);
381+
appendStringInfo(&sql,"select id, rule, postpone, _next_exec_time, next_time_statement from cron where active and not broken and (start_date <= 'now' or start_date is null) and (end_date>= 'now' or end_date is null) and node = '%s'",ctx->nodename);
382382

383383
pgstat_report_activity(STATE_RUNNING,"select 'at' tasks");
384384

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp