easyop 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +24 -1
- data/README.md +14 -0
- data/lib/easyop/plugins/async.rb +12 -0
- data/lib/easyop/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9157dccd94c6847b4b83c01404b64d48ffe54f1f6f51a99e0263bb718a2acdc4
|
|
4
|
+
data.tar.gz: 62bbaa697722e2b0d1979bc5a20839fb9dc765ee22d989f404591129a8a72c01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 52fc250d99c11808462344afb74603081aa2dd35ca4f4d16ec263d19b3c098bba77ddcdda7963793483a9bfc0b04bd2cf63a70700c9756e0fb6b4610229ecc9f
|
|
7
|
+
data.tar.gz: 778348d6dc863bdda5816a32738ae2262c3948eb3711090b0a4412bc0678a9dc9b7c87e48cd937c3f1842e492f5be787c252c42f8ae9955191794cc9200dfc1e
|
data/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.1.2] — 2026-04-13
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **`Plugins::Async` — `queue` DSL** — a new `queue` class method for declaring the default queue directly on an operation class (or a shared base class). This lets subclasses override the queue set at plugin install time without re-declaring the plugin:
|
|
15
|
+
|
|
16
|
+
```ruby
|
|
17
|
+
class Weather::BaseOperation < ApplicationOperation
|
|
18
|
+
queue :weather # all Weather ops use the "weather" queue
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
class Weather::FetchForecast < Weather::BaseOperation
|
|
22
|
+
# inherits queue :weather automatically
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
class Weather::CleanupExpiredDays < Weather::BaseOperation
|
|
26
|
+
queue :low_priority # override just for this class
|
|
27
|
+
end
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Accepts both `Symbol` and `String`. The setting is inherited by subclasses and can be overridden at any level of the hierarchy.
|
|
31
|
+
|
|
10
32
|
## [0.1.1] — 2026-04-01
|
|
11
33
|
|
|
12
34
|
### Fixed
|
|
@@ -43,6 +65,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
43
65
|
- `examples/easyop_test_app/` — full Rails 8 blog application demonstrating all features in real-world code
|
|
44
66
|
- `examples/usage.rb` — 13 runnable plain-Ruby examples
|
|
45
67
|
|
|
46
|
-
[Unreleased]: https://github.com/pniemczyk/easyop/compare/v0.1.
|
|
68
|
+
[Unreleased]: https://github.com/pniemczyk/easyop/compare/v0.1.2...HEAD
|
|
69
|
+
[0.1.2]: https://github.com/pniemczyk/easyop/compare/v0.1.1...v0.1.2
|
|
47
70
|
[0.1.1]: https://github.com/pniemczyk/easyop/compare/v0.1.0...v0.1.1
|
|
48
71
|
[0.1.0]: https://github.com/pniemczyk/easyop/releases/tag/v0.1.0
|
data/README.md
CHANGED
|
@@ -672,6 +672,20 @@ Newsletter::SendBroadcast.call_async(attrs, wait_until: Date.tomorrow.noon)
|
|
|
672
672
|
Newsletter::SendBroadcast.call_async(attrs, queue: "low_priority")
|
|
673
673
|
```
|
|
674
674
|
|
|
675
|
+
**`queue` DSL** — declare the default queue directly on a class (or a shared base class) instead of at plugin install time:
|
|
676
|
+
|
|
677
|
+
```ruby
|
|
678
|
+
class Weather::BaseOperation < ApplicationOperation
|
|
679
|
+
queue :weather # all Weather ops use the "weather" queue by default
|
|
680
|
+
end
|
|
681
|
+
|
|
682
|
+
class Weather::CleanupExpiredDays < Weather::BaseOperation
|
|
683
|
+
queue :low_priority # override just for this class
|
|
684
|
+
end
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
The `queue` setting is inherited by subclasses and can be overridden at any level. Accepts `Symbol` or `String`. A per-call `queue:` argument to `.call_async` always takes precedence.
|
|
688
|
+
|
|
675
689
|
**ActiveRecord objects** are serialized by `(class, id)` and re-fetched in the job:
|
|
676
690
|
|
|
677
691
|
```ruby
|
data/lib/easyop/plugins/async.rb
CHANGED
|
@@ -27,6 +27,18 @@ module Easyop
|
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
module ClassMethods
|
|
30
|
+
# Declares a non-default queue for this operation class and its subclasses.
|
|
31
|
+
#
|
|
32
|
+
# @example
|
|
33
|
+
# class Weather::BaseOperation < ApplicationOperation
|
|
34
|
+
# queue :weather
|
|
35
|
+
# end
|
|
36
|
+
#
|
|
37
|
+
# @param name [String, Symbol] queue name
|
|
38
|
+
def queue(name)
|
|
39
|
+
@_async_default_queue = name.to_s
|
|
40
|
+
end
|
|
41
|
+
|
|
30
42
|
# Enqueue the operation as a background job.
|
|
31
43
|
#
|
|
32
44
|
# MyOp.call_async(email: "x@y.com")
|
data/lib/easyop/version.rb
CHANGED