From 5e41ca21f988f45b3532d335a2d3240b60a7d69b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 17 Mar 2020 23:21:20 +0100 Subject: [PATCH] Convert interval into seconds The correct way to convert interval into seconds is to use "EXTRACT(EPOCH FROM ...)". The "SECOND" gives only the value of the second field. issue9126 review297181005 --- trytond/ir/queue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trytond/ir/queue.py b/trytond/ir/queue.py index e294dc067a..176dc7f8b5 100644 --- a/trytond/ir/queue.py +++ b/trytond/ir/queue.py @@ -108,7 +108,7 @@ class Queue(ModelSQL): selected.for_ = For('UPDATE') next_timeout = With('seconds', query=candidates.select( - Min(Extract('second', + Min(Extract('EPOCH', candidates.scheduled_at - CurrentTimestamp()) ), where=candidates.scheduled_at >= CurrentTimestamp()))