mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-10-19 07:34:58 +00:00
Merge pull request #2129 from AnishSarkar22/fix/plugins-interrupted-runs-timestamp
fix(plugins): stop failing runs queued in the worker's first second
This commit is contained in:
commit
a52017e750
1 changed files with 4 additions and 2 deletions
|
|
@ -1,7 +1,7 @@
|
|||
from datetime import UTC, datetime
|
||||
|
||||
import psutil
|
||||
from sqlalchemy import and_, or_, select
|
||||
from sqlalchemy import and_, func, or_, select
|
||||
|
||||
from modules.plugins.models import PluginRun, PluginRunStatus
|
||||
from shared.config import get_storage_settings
|
||||
|
|
@ -26,7 +26,9 @@ def fail_interrupted_runs() -> None:
|
|||
PluginRun.status == PluginRunStatus.RUNNING,
|
||||
and_(
|
||||
PluginRun.status == PluginRunStatus.QUEUED,
|
||||
PluginRun.created_at < started,
|
||||
# created_at is CURRENT_TIMESTAMP text, whole seconds;
|
||||
# raw, it sorts before a bound datetime of the same second.
|
||||
PluginRun.created_at < func.datetime(started),
|
||||
),
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue