Skip to content

Conversation

@akadusei
Copy link
Contributor

@akadusei akadusei commented Jan 7, 2026

This allows to use Mel with PostgreSQL as store. Should work well for CockroachDB too.

This is probably a better alternative to using tools like Redka. See #6

@akadusei akadusei marked this pull request as ready for review January 7, 2026 23:40
- `#orphan_score` -> `#orphan_timestamp`
- `#running_score` -> `#running_timestamp`

This gives it a more general name as "score" is specific to redis.
@akadusei akadusei closed this Jan 8, 2026
@akadusei akadusei deleted the postgres branch January 8, 2026 22:51
@akadusei akadusei restored the postgres branch January 8, 2026 22:53
@akadusei akadusei deleted the postgres branch January 8, 2026 22:58
@akadusei akadusei restored the postgres branch January 9, 2026 01:04
@akadusei akadusei reopened this Jan 9, 2026
```
Failures:

  1) Mel::Task #run does not retry beyond current schedule window
     Failure/Error: Mel::PeriodicTask.find(id).try(&.attempts).should eq(0)

       Expected: 0
            got: 1

Error:      # spec/mel/task_spec.cr:62

  2) Mel::Task #run retries beyond current schedule window if task not rescheduled
     Failure/Error: Mel::PeriodicTask.find(id).try(&.attempts).should eq(2)

       Expected: 2
            got: 1

Error:      # spec/mel/task_spec.cr:84

  3) Mel::Task #run deletes tasks from env after completion
     Failure/Error: Mel::RunPool.fetch.should_not be_empty

       Expected: Set{} not to be empty

Error:      # spec/mel/task_spec.cr:107

  4) Mel::Task .find_due skips running jobs
     Failure/Error: Mel::InstantTask.find_due(count: -1, delete: nil).try(&.size).should eq(1)

       Expected: 1
            got: nil

Error:      # spec/mel/task_spec.cr:214

Finished in 36.32 seconds
352 examples, 4 failures, 0 errors, 0 pending

Failed examples:

crystal spec spec/mel/task_spec.cr:49 # Mel::Task #run does not retry beyond current schedule window
crystal spec spec/mel/task_spec.cr:66 # Mel::Task #run retries beyond current schedule window if task not rescheduled
crystal spec spec/mel/task_spec.cr:97 # Mel::Task #run deletes tasks from env after completion
crystal spec spec/mel/task_spec.cr:211 # Mel::Task .find_due skips running jobs
Error: Process completed with exit code 1.
```

See <https://github.com/GrottoPress/mel/actions/runs/20850402291>.
@akadusei akadusei merged commit 434cb93 into master Jan 9, 2026
10 checks passed
@akadusei akadusei deleted the postgres branch January 9, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants