activejob-compressible 1.0.0 → 1.1.0
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 +6 -0
- data/README.md +3 -0
- data/lib/activejob/compressible/version.rb +1 -1
- data/lib/activejob/compressible.rb +6 -9
- data/sig/activejob/compressible.rbs +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: e120d069c5f8bf4bf6f43b43acffba86a49138e884b09c195bb0d4fb2a23a430
|
4
|
+
data.tar.gz: ca9416bf3f577ef85bfd12d7d2e8278bf273b4231774ebb24487c838860fdc76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3a511761a47f9c78b55efccaad6d7b9e677c2306eef34b6989061619ecf11d32de3d25a4013a580d895de8de40c69f95bfbd16c16ed6aa907b03bf479104098
|
7
|
+
data.tar.gz: c09cdb8562ed106d1e19535d276527e64f54467c5b81ce694bb4dd7a756bc1fe849d3ac656a790d05e898fcf09a0d0e60ea24b4458b1d025c14b62b934768c76
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [1.1.0] - 2025-06-05
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Now properly handles all arguments and keyword arguments for compression.
|
13
|
+
|
8
14
|
## [1.0.0] - 2025-06-05
|
9
15
|
|
10
16
|
### Added
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# ActiveJob::Compressible
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/activejob-compressible)
|
4
|
+
[](https://github.com/Archetypically/activejob-compressible/actions/workflows/ci.yml)
|
5
|
+
|
3
6
|
Transparent compression for large ActiveJob payloads to avoid cache backend limits.
|
4
7
|
|
5
8
|
## Overview
|
@@ -18,10 +18,10 @@ module ActiveJob
|
|
18
18
|
# end
|
19
19
|
#
|
20
20
|
# How it works:
|
21
|
-
# - When the job is serialized (enqueued),
|
22
|
-
# - If the
|
23
|
-
#
|
24
|
-
# - When the job is deserialized (dequeued), the
|
21
|
+
# - When the job is serialized (enqueued), all arguments are checked together.
|
22
|
+
# - If the arguments' JSON representation exceeds the compression threshold,
|
23
|
+
# they are compressed using zlib and base64, and marked with a special key.
|
24
|
+
# - When the job is deserialized (dequeued), the arguments are checked for the marker and
|
25
25
|
# transparently decompressed if needed.
|
26
26
|
# - Old jobs (with uncompressed payloads) are still supported for backward compatibility.
|
27
27
|
#
|
@@ -37,18 +37,15 @@ module ActiveJob
|
|
37
37
|
included do
|
38
38
|
def serialize
|
39
39
|
super.tap do |h|
|
40
|
-
|
41
|
-
h["arguments"][0] = self.class.compress_if_needed(h["arguments"].first)
|
42
|
-
end
|
40
|
+
h["arguments"] = self.class.compress_if_needed(h["arguments"]) if h["arguments"]
|
43
41
|
end
|
44
42
|
end
|
45
43
|
end
|
46
44
|
|
47
45
|
class_methods do
|
48
46
|
def deserialize(job_data)
|
49
|
-
arg = job_data["arguments"].first
|
50
47
|
job_data = job_data.dup
|
51
|
-
job_data["arguments"]
|
48
|
+
job_data["arguments"] = decompress_if_needed(job_data["arguments"])
|
52
49
|
super
|
53
50
|
end
|
54
51
|
|
@@ -7,7 +7,7 @@ module ActiveJob
|
|
7
7
|
module ClassMethods
|
8
8
|
def deserialize: (Hash[String, untyped] job_data) -> ActiveJob::Base
|
9
9
|
|
10
|
-
def compress_if_needed: (
|
10
|
+
def compress_if_needed: (untyped obj) -> (untyped | Hash[String, String | bool])
|
11
11
|
|
12
12
|
def decompress_if_needed: (untyped arg) -> untyped
|
13
13
|
|