snerdmq 0.3.3 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +41 -3
  3. data/snerdmq.gemspec +1 -1
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85e9f934b6976cdbd8c95718707762e2da87e93ea53448a51b3983b40d145f26
4
- data.tar.gz: 82d99ccce4066f516da45f536e36f8539d569cdf47d1a74442b1557086830243
3
+ metadata.gz: 49f0d03ac996ffe2018f862d5a82f0a73fec5281a1d1097727ad369f4a112ab2
4
+ data.tar.gz: 1ac5125ecef4e6d40cbcc4103b96aa18a6d002c1ee7371135720df6fc4370f20
5
5
  SHA512:
6
- metadata.gz: b18cee9ae796c2c612d44bea8c6aa0e81725e4a27f7f4001bb4c1d66acafc89ea2766c21e573dedebf45a8689b4b2a60abc885ad0d13a632de4da3d9934e2d5c
7
- data.tar.gz: 815dc8ba1eb2977aba024af95fba389753a0428d3483c3db438e8ced86fada4666c0375d7d6d4b032a3705ac2f8c9fe30aea5c82d9967adc1260c17cfcf53d86
6
+ metadata.gz: 4de56bd72675519a68bc92e81553cc3a3033fa9f9e06786dcf3b2b79b79d83741730fd91dce142ff9230c64fa090b5ba8c0a65acbfeb4299f5126a3b61d3fb6e
7
+ data.tar.gz: 67987b9a61af61b50606577063103b7e6ca5feb3398dd0946e22b85396d40276ed80c2d78e66a73a1670a327af043e1e072e1c02f1e07263de8e6d25d63449cb
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  <div align="center">
2
2
  <img src="./assets/Designer-9.png" height="120" alt="SnerdMQ Ruby Logo" />
3
- <h1>💎 SnerdMQ Ruby SDK v0.3.3</h1>
3
+ <h1>💎 SnerdMQ Ruby SDK v0.3.5</h1>
4
4
  <p>A zero-config, C-speed background job queue for Ruby. Ditch Redis and Sidekiq for lightweight, persistent background jobs.</p>
5
5
 
6
6
  [![Gem Version](https://badge.fury.io/rb/snerdmq.svg)](https://badge.fury.io/rb/snerdmq)
@@ -9,7 +9,7 @@
9
9
 
10
10
  This is the official Ruby SDK wrapper for **SnerdMQ**. It handles all JSON-RPC communication and `IO.popen` orchestration so you can write lightning-fast background jobs without managing any external databases like Redis or Postgres.
11
11
 
12
- ## ✨ v0.3.3 AI Features
12
+ ## ✨ v0.3.5 AI Features
13
13
  - **Smart API Rate-Limiting**: Natively tracks `rate_limit_group` execution velocity to prevent 429 "Too Many Requests" API errors.
14
14
  - **Payload-Hashing Deduplication**: Automatically computes cryptographic hashes to drop duplicate tasks instantly.
15
15
  - **Dynamic Float Prioritization**: A native Binary Max-Heap bypasses standard FIFO rules for high urgency tasks.
@@ -18,7 +18,7 @@ This is the official Ruby SDK wrapper for **SnerdMQ**. It handles all JSON-RPC c
18
18
  - **Zero Rust Required**: Our gem installation script automatically downloads the pre-compiled C-speed Rust binary for your OS.
19
19
  - **Thread Safe**: Uses native Ruby `Thread`s and `Mutex` locks to orchestrate I/O without blocking your main event loop.
20
20
 
21
- ### ⚙️ Advanced Task Configuration (v0.3.3)
21
+ ### ⚙️ Advanced Task Configuration (v0.3.5)
22
22
  To power complex AI workflows, tasks can now be configured with advanced orchestration parameters:
23
23
 
24
24
  * **`auto_dedupe` (`true/false`)**: If set to `true`, the daemon computes a cryptographic hash of the `task_type` and `data`. If an identical payload is currently sitting in the queue pending execution, this new task is silently dropped. Excellent for preventing duplicate generative AI requests from trigger-happy users!
@@ -241,3 +241,41 @@ queue = Snerdmq::SnerdQueue.new(storage_path: "/var/data/snerd") # per-server st
241
241
  A shared network drive (AWS EFS or NFS) is still a good home for that storage when a single instance needs durable state — e.g. a container that restarts but must keep its queue. Native OS file locking (`flock`) keeps writes safe — no Redis required.
242
242
 
243
243
  *Built with ❤️ for John Wick tier engineering.*
244
+
245
+
246
+ ## Architecture Best Practices
247
+
248
+ When building production applications with SnerdMQ, it is recommended to initialize the queue as a Singleton, isolate your domain workers into separate files/functions, use Dead Letter Queues (DLQ) for failed tasks via `RegisterMaxRetryHandler`, and ensure manual graceful shutdown. The embedded Dashboard UI can also be easily served from the same instance.
249
+
250
+ ```ruby
251
+ require 'snerdmq'
252
+
253
+ queue = SnerdQueue.new(storage_path: "./.snerdata")
254
+
255
+ def init_email_workers(queue)
256
+ queue.register_handler('send_email') do |data|
257
+ puts "Sending email to #{data['email']}..."
258
+ end
259
+
260
+ queue.register_max_retry_handler('send_email') do |data|
261
+ puts "Email to #{data['email']} failed permanently. Dead letter processing..."
262
+ end
263
+ end
264
+
265
+ def init_image_workers(queue)
266
+ queue.register_handler('process_image') do |data|
267
+ puts "Processing image #{data['imageId']}..."
268
+ end
269
+ end
270
+
271
+ init_email_workers(queue)
272
+ init_image_workers(queue)
273
+
274
+ queue.start_dashboard(8080)
275
+
276
+ # Trap signals for graceful shutdown
277
+ trap('INT') { queue.shutdown; exit }
278
+ trap('TERM') { queue.shutdown; exit }
279
+
280
+ queue.start_listening
281
+ ```
data/snerdmq.gemspec CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "snerdmq"
6
- spec.version = "0.3.3"
6
+ spec.version = "0.3.5"
7
7
  spec.authors = ["Greyhands2"]
8
8
  spec.email = ["developer@example.com"]
9
9
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snerdmq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greyhands2
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-08-19 00:00:00.000000000 Z
11
+ date: 2026-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack