Commit graph

36 commits

Author SHA1 Message Date
Adriano Caloiaro
5aee2b2582 fix: unprocessed jobs from unwatched queues block watched queues
There could be a condition where jobs were added to a queue that is not longer being watched,
yet the jobs in those queues would continue appearing in the pending job list because
the query to get pending jobs did not filter by queues being watched.
2025-02-13 10:24:08 -07:00
Adriano Caloiaro
17c86fa00e fix: execessive connection usage when monitoring pending jobs
The previous release attempted to fix an issue where, when LISTEN connections
drop an reconnect, some job announcements might be missed.

This fix reduces the number of connections required to do so.
2025-01-25 16:48:44 -08:00
Adriano Caloiaro
3b3a7fe388 fix(postgres): jobs may never get processed if no workers hear the initial announcement
When jobs are inserted into the 'neoq_jobs', the `announce_job` trigger announces the job to
listeners of the job's queue. However, if no workers are available to receive the announcement,
or the announcement is somehow lost, it meant those jobs were marooned on the queue.

This fix adds a periodic check for post-due pending jobs to ensure that a neoq restart is
not necessary to catch marooned, overdue jobs.
2025-01-25 13:01:03 -08:00
Adriano Caloiaro
0105403be9 feat: add support for recovery callbacks 2024-04-16 13:52:54 -06:00
Adriano Caloiaro
1598184f74 fix: Add deadline to pool connection acquisition 2023-11-11 17:18:35 -07:00
Adriano Caloiaro
de2e101736 feat: Default to disable synchronous postgres commit 2023-10-03 08:41:59 -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
20f5b139b5 break: Rename types.Backend -> neoq.Neoq 2023-09-07 12:36:02 +02:00
43a0a133f2
Add log level support (#49) 2023-05-02 20:17:53 -06:00
aabb567636
remove unused errors 2023-03-17 08:58:57 -07:00
5b6620927e
Move backends to separate packages 2023-03-01 10:34:27 -07:00
dbeb85518f
Add logger configuration options
- Add ConfigOption for logger configuration
- Extend Neoq interface with SetLogger()
- Remove error return value from Shutdown()
- Remove WithConfig from Neoq interface
2023-02-24 11:35:35 -07:00
145c9df2fd
Fix memory backend test and WithOptions() 2023-02-24 08:49:56 -07:00
Juan C. Müller
56a64d7620
Provide WithOptions instead 2023-02-23 21:38:22 -05:00
acd50c4d1f
Update WithLogger TODO 2023-02-23 13:02:20 -07:00
895ea02a26
Make future job check interval configurable
- Make future job check interval configurable in MemBackend (fixes #11)
- Make interval of time for which jobs are dedicated a goroutine use a default in MemBackend (fixes #12)
- Make future job check interval configurable in PgBackend (fixes #18)
- Make interval of time for which jobs are dedicated a goroutine use a default in PgBackend (fixes #19)
2023-02-23 12:46:12 -07:00
a024be6a39
Updated code TODOs 2023-02-23 11:53:24 -07:00
Adriano Caloiaro
93a646ae27
Add in-memory backend
Co-authored-by: Juan C. Müller <jcmuller@users.noreply.github.com>
2023-02-23 09:35:14 -07:00
Adriano Caloiaro
d253b50a58
Remove *Opt suffix from WithConfig 2023-02-18 10:49:19 -08:00
Adriano Caloiaro
9ba0f623e4
Move queries to postgres_backend.go 2023-02-18 09:19:47 -08:00
Juan C. Müller
5517a67c9e
Align struct 2023-02-17 23:07:07 -05:00
Juan C. Müller
697df812c6
Use durations 2023-02-17 23:07:00 -05:00
Juan C. Müller
ca55aa6c3e
Group job status consts 2023-02-17 23:06:29 -05:00
Juan C. Müller
44db35bda9
Pass in contexts 2023-02-17 23:06:03 -05:00
Adriano Caloiaro
2dd5325363
Rename PgBackend so it doesn't stutter 2023-02-17 16:11:13 -08:00
Adriano Caloiaro
fcc9f0ea24
Fix examples and remove 'sslmode' from default connect string 2023-02-17 16:06:04 -08:00
Adriano Caloiaro
9dff9f241c
Refactor: separate neoq core from backends
- API now supports user-supplied backends when calling neoq.New()
- Separated postgres backend code from core API
2023-02-17 15:50:03 -08:00
Adriano Caloiaro
f1f5ea2988
Add periodic job support 2023-02-17 11:29:06 -08:00
Adriano Caloiaro
0984795a16
Refactor Handler WithOption function names 2023-02-17 09:40:01 -08:00
Adriano Caloiaro
40d411fb03
Remove logger from Hander 2023-02-17 08:59:20 -08:00
Adriano Caloiaro
3a1dbe093b
improve logging functionality 2023-02-16 15:15:39 -08:00
Adriano Caloiaro
191453651b
Don't export Handler fields 2023-02-16 12:24:43 -08:00
Adriano Caloiaro
dd30508c2a
Add index for 'fingerprint' field 2023-02-16 12:20:20 -08:00
Adriano Caloiaro
84826b5f0a
Use time.Until instead of t.Sub(time.Now()) 2023-02-15 10:59:59 -08:00
Adriano Caloiaro
1f86274be9
Documentation improvements 2023-02-14 14:55:40 -08:00
Adriano Caloiaro
ad6f6c0387
Initial commit 2023-02-13 15:35:55 -08:00