Skip to content

Commit

Permalink
Merge pull request #59 from mariux64/issue-58
Browse files Browse the repository at this point in the history
sql: Avoid time running backwards
  • Loading branch information
donald authored May 10, 2017
2 parents 7276703 + a054505 commit 9802442
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mysql/create_trigger.sql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ CREATE TRIGGER mxq_add_group BEFORE INSERT ON mxq_group
DROP TRIGGER IF EXISTS mxq_update_group|
CREATE TRIGGER mxq_update_group BEFORE UPDATE ON mxq_group
FOR EACH ROW BEGIN
SET NEW.group_mtime = NOW();
SET NEW.group_mtime = GREATEST(OLD.group_mtime, NOW());

IF OLD.group_jobs_inq > 0 AND OLD.group_jobs_running = 0 THEN
SET NEW.stats_wait_sec = OLD.stats_wait_sec + (UNIX_TIMESTAMP(NEW.group_mtime) - UNIX_TIMESTAMP(OLD.group_mtime));
Expand Down

0 comments on commit 9802442

Please sign in to comment.