Skip to content

Commit 43d5763

Browse files
author
Anze
committed
Initialize DB connection only after apscheduler forks processes
1 parent c2b42b5 commit 43d5763

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

snmpbot.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ def jobs(self):
410410
Each entity (device) is a single job, no matter how many sensors it has. The reason is
411411
that when the intervals align, we can then issue a single SNMP Bulk GET/WALK.
412412
"""
413+
migrate_if_needed()
413414
for entity_info in self.fetch_job_configs('snmp'):
414415
intervals = list(set([sensor_info["interval"] for sensor_info in entity_info["sensors"]]))
415416
job_info = { **entity_info, "backend_url": self.backend_url, "bot_token": self.bot_token }
@@ -462,7 +463,5 @@ def wait_for_grafolean(backend_url):
462463
if not bot_token:
463464
raise Exception("Please specify BOT_TOKEN / BOT_TOKEN_FROM_FILE env var.")
464465

465-
migrate_if_needed()
466-
467466
c = SNMPBot(backend_url, bot_token, jobs_refresh_interval)
468467
c.execute()

0 commit comments

Comments
 (0)