Commit graph

33 commits

Author SHA1 Message Date
Adriano Caloiaro
0105403be9 feat: add support for recovery callbacks 2024-04-16 13:52:54 -06:00
Adriano Caloiaro
b401809190 feat: fix infinite scheduling loop when job gets scheduled after deadline 2024-03-27 12:11:14 -06:00
Adriano Caloiaro
441a39271b fix: An incorrect error was thrown when jobs exceeding their deadline were scheduled
Co-authored-by: Philip Constantinou <1383834+pconstantinou@users.noreply.github.com>
2024-03-25 11:58:08 -06:00
Fernando Barillas
672e101e6b feat: Update migrations postgres URI parsing and add tests 2024-03-04 19:57:51 -07:00
Adriano Caloiaro
9a555f1407 chore: Add test coverage over postgres future jobs 2024-03-02 10:16:14 -07:00
Adriano Caloiaro
7798b35827 Fix lints 2024-01-26 09:21:05 -07:00
Adriano Caloiaro
86f7869440 feat: Multiplex the listener connection 2023-12-12 15:44:28 -07:00
Adriano Caloiaro
1598184f74 fix: Add deadline to pool connection acquisition 2023-11-11 17:18:35 -07:00
Adriano Caloiaro
e95311e76d fix: #98 retries can be picked up by wrong handler
Fixes a bug that can allow retries to end up on
the wrong queue in settings where there are
multiple handlers.
2023-10-21 07:31:54 -06:00
Elliot Courant
8b21247f9b fix(pg): Fixing notify handling name cases oddly.
This makes it so that channel names for NOTIFY/LISTEN/UNLISTEN are
consistent. That is that they are double quoted in all instances except
for when they are referenced by `pg_notify`. This way the channel names
are no longer case-insensitive.

This happens because of how PostgreSQL parses the SQL statements for
NOTIFY/LISTEN/UNLISTEN and treats the arguments as an identifier. Where
as it treats the arguments to `pg_notify` as only a string. This causes
arguments that are not double quoted to be adjusted to lower case when
passed to the SQL statement.

By making all usages consistent, we no longer have to worry about
channel names being odd.
2023-10-15 14:51:13 -06:00
Elliot Courant
3a10351049 bug(pg): Adding test to demonstrate bug with uppercase queue names
When the queue name is uppercase, the listener will never receive the
notification when the job is enqueued. This is done specifically with
the enqueuer and consumer being separate neoq instances (server A kicks
off a job, server B is listening to perform the work).
2023-10-15 14:51:13 -06:00
Adriano Caloiaro
84caae3438 fix: #98 segvault when moving jobs to dead queue 2023-10-13 10:48:29 -06:00
Elliot Courant
26c69211a9 fix(pg): Fixed data race conditions in unit tests
Since these values are being written in a separate go routine, it is
possible for a datarace to happen since we are reading them
unatomically. This just makes it so that both the reads ands writes are
done atomically.

Resolves #76
2023-10-06 12:50:20 -06:00
Elliot Courant
42da4d8110
fix(pg): Fixed error logs for multi node cron jobs. (#94)
Resolves #76
2023-10-06 12:07:29 -05:00
Adriano Caloiaro
c04ef692a7 Update github action config 2023-10-04 10:05:04 -06:00
Adriano Caloiaro
afd1f4c1aa fix: MaxRetries not persisting in PG backend 2023-10-04 10:05:04 -06:00
Elliot Courant
52e118ebcc chore(test): Adding a test for multiple consumers with the pg backend.
This test is to provide a minimal proof that jobs can be consumed by
multiple workers and in a way can only be consumed once. If the
execCount does not match the expected count then this test will fail
because either too many jobs were executed (like one executing twice) or
a job was dropped when it should not have been.
2023-09-27 18:12:34 -06:00
Adriano Caloiaro
6a368e05fc Make multiple queue test less finicky 2023-09-22 07:40:48 -06:00
Adriano Caloiaro
23098bcdc5 break: Move queue name into Handler
This goal of this change is to simplify the API. Handlers and queues
have a 1:1 mapping, so functions that receive both a `queue` and a
`handler` take two parameters when they could take only one.
2023-09-17 00:15:19 +02:00
Adriano Caloiaro
2ce00761c7 maint: clean up testutils/TestLogger 2023-09-07 12:36:02 +02:00
Adriano Caloiaro
6ea1bb692f feat: Improve postgres duplicate job detection performance
Previously, neoq would query to see if new jobs' (fingerprint, status)
tuple were unique. This change adds a unique index on (fingerprint,
status) and simply allows unique key constraint violations to be
returned from `Enqueue` instead. This prevents one additional query
for every new queue item.
2023-09-02 14:59:32 +02:00
Adriano Caloiaro
72594867e5 Support job deadlines
Fixes #52
2023-08-28 20:01:21 +02:00
Adriano Caloiaro
631c508813 Fix memory backend support for multiple queues
Fixes #56
2023-08-20 10:16:45 -06:00
c237f31b4e Fix slog API change issue 2023-07-17 07:54:22 -06:00
43a0a133f2
Add log level support (#49) 2023-05-02 20:17:53 -06:00
71dd54b180
Fix postgres Handler error handling (#47) 2023-04-26 10:54:02 -06:00
aaed37eeb5
Add redis support (#44) 2023-04-14 19:11:22 -06:00
219ea84d76
Move config.WithConnectionString -> postgres.WithConnectionString (#43) 2023-04-01 18:03:55 -07:00
4639e53980
Update docs regarding lost connections while updating jobs (#39) 2023-03-18 12:22:27 -07:00
eb430e9444
Acquire a new connection for every queue listener (#38) 2023-03-18 09:52:48 -07:00
07a336a397
Make handler context vars backend agnostic (#37) 2023-03-17 08:53:16 -07:00
621b105213
Refactor ReplaceNonAlphanum() to use regex.ReplaceAllString() 2023-03-07 09:24:46 -07:00
5b6620927e
Move backends to separate packages 2023-03-01 10:34:27 -07:00
Renamed from postgres_backend_test.go (Browse further)