Skip to content

Commit 5985519

Browse files
committed
hack(sampler): delay init of schedule
Django reload timezone which throws out schedule
1 parent 8a6357e commit 5985519

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

commitlint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ const scope = [
55
"route",
66
"task",
77
"validator",
8+
"sampler"
89
];
910

1011
module.exports = {

sentry_dynamic_sampling_lib/sampler.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ def __init__(self, stop, config, metric, *args, **kwargs) -> None:
3131
super().__init__(*args, name="SentryControllerClient", **kwargs)
3232

3333
def run(self):
34+
# HACK: Django change the timezone mid startup
35+
# Which break the datetime.datetime.now() method
36+
# This then break schedule by delaying the startup by the timezone delta
37+
sleep(5)
3438
schedule.every(self.poll_interval).seconds.do(self.update_config)
3539
schedule.every(self.metric_interval).seconds.do(self.update_metrics)
3640
while not self.stop.is_set():

0 commit comments

Comments
 (0)