Skip to content

Commit 8f05729

Browse files
authored
Stop relying on fugit (#2519)
* Stop relying on fugit It is an overkill to have a (implicit) dependency on fugit, especially that it doesn't even offer a public interface to do what we need. It's older version don't support timezones in cron which I believe is the culprit in #2513. Even if it's not, I still think it's a good change. * Update CHANGELOG
1 parent a4e76ce commit 8f05729

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818
- Test Ruby 3.4 in CI ([#2506](https://github.com/getsentry/sentry-ruby/pull/2506))
1919
- Upgrade actions workflows versions ([#2506](https://github.com/getsentry/sentry-ruby/pull/2506))
20+
- Stop relying on fugit ([#2519](https://github.com/getsentry/sentry-ruby/pull/2519))
2021

2122
## 5.22.1
2223

sentry-sidekiq/lib/sentry/sidekiq-scheduler/scheduler.rb

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,14 @@ def new_job(name, interval_type, config, schedule, options)
3838
monitor_config =
3939
case interval_type
4040
when "cron"
41-
# fugit is a second order dependency of sidekiq-scheduler via rufus-scheduler
42-
parsed_cron = ::Fugit.parse_cron(schedule)
43-
timezone = parsed_cron.timezone
41+
# Split schedule into cron and timezone parts (if timezone exists)
42+
cron_parts = schedule.strip.split(" ")
4443

45-
# fugit supports having the timezone part of the cron string,
46-
# so we need to pull that with some hacky stuff
47-
if timezone
48-
parsed_cron.instance_variable_set(:@timezone, nil)
49-
cron_without_timezone = parsed_cron.to_cron_s
50-
Sentry::Cron::MonitorConfig.from_crontab(cron_without_timezone, timezone: timezone.name)
44+
if cron_parts.length > 5
45+
timezone = cron_parts.pop
46+
cron_without_timezone = cron_parts.join(" ")
47+
48+
Sentry::Cron::MonitorConfig.from_crontab(cron_without_timezone, timezone: timezone)
5149
else
5250
Sentry::Cron::MonitorConfig.from_crontab(schedule)
5351
end

0 commit comments

Comments
 (0)