Skip to content

Commit 52ba912

Browse files
authored
mon-greenlet_spawn-has-not-been-called-v3 (#379)
1 parent 4ab3eac commit 52ba912

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

backend/deepchecks_monitoring/bgtasks/scheduler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ async def run_organization(self, organization):
138138
# Aggregate the monitors per model in order to query the versions windows data only once per model
139139
monitors_per_model = defaultdict(list)
140140
for monitor in list_monitor_scalars:
141-
session.expunge(monitor)
142141
monitors_per_model[monitor.check.model].append(monitor)
143142

144143
for model, monitors in monitors_per_model.items():
@@ -162,6 +161,7 @@ async def run_organization(self, organization):
162161
# For each monitor enqueue schedules
163162
for monitor in monitors:
164163
schedules = []
164+
session.add(monitor)
165165
frequency = monitor.frequency.to_pendulum_duration()
166166
schedule_time = monitor.next_schedule
167167

@@ -177,7 +177,6 @@ async def run_organization(self, organization):
177177
try:
178178
await enqueue_tasks(monitor, schedules, organization, session)
179179
monitor.latest_schedule = schedules[-1]
180-
session.add(monitor)
181180
await session.commit()
182181
# NOTE:
183182
# We use 'Repeatable Read Isolation Level' to run query therefore transaction serialization

0 commit comments

Comments
 (0)