-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not execute removed cron workloads (#17)
We need to check whether a workload was enqueued with a scheduler key, but no longer is in the cron table. If that is the case (we are trying to execute a workload which has a scheduler key, but the scheduler does not know about that key) it means that the workload has been removed from the cron table and must not run. Moreover: running it can be dangerous because it was likely removed from the table for a reason. Should that be the case, mark the job "finished" and return `nil` to get to the next poll. If the deployed worker still has the workload in its scheduler table, but a new deploy removed it - this is a race condition, but we are willing to accept it. Note that we are already "just not enqueueing" that job when the cron table gets loaded - but it is not enough. If our system can be in a state of partial deployment: ``` [ release 1 does have some_job_hourly crontab entry ] [ release 2 no longer does ] ^ --- race conditions possible here --^ ``` ...and we remove the crontabled workloads during app boot, it does not give us a guarantee that release 1 won't reenqueue them. For example, via the "reinsert next scheduled" feature when the job is executing. This is why this safeguard is needed. This protects us from a very dangerous failure mode where we would remove an entry from the cron table, deploy the change, and then still have the workload run a day later. Also, mandate Ruby 3.1 as the minimum version and pin the Standardrb syntax to that.
- Loading branch information
Showing
11 changed files
with
137 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,8 +14,7 @@ jobs: | |
strategy: | ||
matrix: | ||
ruby: | ||
- '2.7' | ||
- '3.3' | ||
- '3.1' | ||
services: | ||
postgres: | ||
image: postgres | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ruby_version: 3.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,64 @@ | ||
## [Unreleased] | ||
|
||
## [0.1.0] - 2024-06-10 | ||
|
||
- Initial release | ||
## [0.1.13] - 2024-09-03 | ||
|
||
## [0.1.1] - 2024-06-10 | ||
- Ensure we won't execute workloads which were scheduled but are no longer present in the cron table entries. | ||
|
||
- Fix support for older ruby versions until 2.7 | ||
## [0.1.12] - 2024-07-03 | ||
|
||
## [0.1.2] - 2024-06-11 | ||
- When doing polling, suppress DEBUG-level messages. This will stop Gouda spamming the logs with SQL in dev/test environments. | ||
|
||
- Updated readme and method renaming in Scheduler | ||
## [0.1.11] - 2024-07-03 | ||
|
||
## [0.1.3] - 2024-06-11 | ||
- Fix: make sure the Gouda logger config does not get used during Rails initialization | ||
|
||
- Allow the Rails app to boot even if there is no database yet | ||
## [0.1.10] - 2024-07-03 | ||
|
||
## [0.1.4] - 2024-06-14 | ||
- Fix: remove logger overrides that Gouda should install, as this causes problems for Rails apps hosting Gouda | ||
|
||
- Rescue NoDatabaseError at scheduler update. | ||
- Include tests in gem, for sake of easier debugging. | ||
- Reduce logging in local test runs. | ||
- Bump local ruby version to 3.3.3 | ||
## [0.1.9] - 2024-06-26 | ||
|
||
## [0.1.5] - 2024-06-18 | ||
- Fix: cleanup_preserved_jobs_before in Gouda::Workload.prune now points to Gouda.config | ||
|
||
- Update documentation | ||
- Don't pass on scheduler keys to retries | ||
## [0.1.8] - 2024-06-21 | ||
|
||
- Move some missed instrumentations to Gouda.instrument | ||
|
||
## [0.1.7] - 2024-06-21 | ||
|
||
- Separate all instrumentation to use ActiveSupport::Notification | ||
|
||
## [0.1.6] - 2024-06-18 | ||
|
||
- Fix: don't upsert workloads twice when starting Gouda. | ||
- Add back in Appsignal calls | ||
|
||
## [0.1.7] - 2024-06-21 | ||
## [0.1.5] - 2024-06-18 | ||
|
||
- Separate all instrumentation to use ActiveSupport::Notification | ||
- Update documentation | ||
- Don't pass on scheduler keys to retries | ||
|
||
## [0.1.8] - 2024-06-21 | ||
## [0.1.4] - 2024-06-14 | ||
|
||
- Move some missed instrumentations to Gouda.instrument | ||
- Rescue NoDatabaseError at scheduler update. | ||
- Include tests in gem, for sake of easier debugging. | ||
- Reduce logging in local test runs. | ||
- Bump local ruby version to 3.3.3 | ||
|
||
## [0.1.9] - 2024-06-26 | ||
## [0.1.3] - 2024-06-11 | ||
|
||
- Fix: cleanup_preserved_jobs_before in Gouda::Workload.prune now points to Gouda.config | ||
- Allow the Rails app to boot even if there is no database yet | ||
|
||
## [0.1.10] - 2024-07-03 | ||
## [0.1.2] - 2024-06-11 | ||
|
||
- Fix: remove logger overrides that Gouda should install, as this causes problems for Rails apps hosting Gouda | ||
- Updated readme and method renaming in Scheduler | ||
|
||
## [0.1.11] - 2024-07-03 | ||
## [0.1.1] - 2024-06-10 | ||
|
||
- Fix: make sure the Gouda logger config does not get used during Rails initialization | ||
- Fix support for older ruby versions until 2.7 | ||
|
||
## [0.1.12] - 2024-07-03 | ||
## [0.1.0] - 2024-06-10 | ||
|
||
- Initial release | ||
|
||
- When doing polling, suppress DEBUG-level messages. This will stop Gouda spamming the logs with SQL in dev/test environments. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,10 +9,10 @@ Gem::Specification.new do |spec| | |
spec.email = ["[email protected]", "[email protected]"] | ||
spec.homepage = "https://github.com/cheddar-me/gouda" | ||
spec.license = "MIT" | ||
spec.required_ruby_version = Gem::Requirement.new(">= 2.7.0") | ||
spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0") | ||
spec.require_paths = ["lib"] | ||
|
||
spec.metadata["homepage_uri"] = | ||
spec.metadata["homepage_uri"] = spec.homepage | ||
spec.metadata["source_code_uri"] = spec.homepage | ||
spec.metadata["changelog_uri"] = "https://github.com/cheddar-me/gouda/CHANGELOG.md" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# frozen_string_literal: true | ||
|
||
module Gouda | ||
VERSION = "0.1.12" | ||
VERSION = "0.1.13" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters