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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 28d3f54a6ca82b0bfbc6d00db5ff31159f7ce19fd56e157e2805d913cec79165
4
- data.tar.gz: dd256e7a07ff11bdb73180d05a4f85c1bfb94aab754b7c8d64ab22517aa95bb0
3
+ metadata.gz: e120d069c5f8bf4bf6f43b43acffba86a49138e884b09c195bb0d4fb2a23a430
4
+ data.tar.gz: ca9416bf3f577ef85bfd12d7d2e8278bf273b4231774ebb24487c838860fdc76
5
5
  SHA512:
6
- metadata.gz: d716916f8c7d9d4d8ee07a0ac08caedc9445e9cd6f8a0cd8946f1cc8f635b47fe87b0faa9a9f8c40953061d0bc035a9e0dcb1f0d53b7e444ebc17644c98faf26
7
- data.tar.gz: ed162b58f90dbc68136bd2b5e6132ad4d64afa9d2291904733dd86baa1b87d94c4536334dbaa9822f1d0dffe1a093875d8dc1cb28aa200c476d54a61416257fe
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
+ [![Gem Version](https://badge.fury.io/rb/activejob-compressible.svg)](https://badge.fury.io/rb/activejob-compressible)
4
+ [![CI](https://github.com/Archetypically/activejob-compressible/actions/workflows/ci.yml/badge.svg)](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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module ActiveJob
4
4
  module Compressible
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
@@ -18,10 +18,10 @@ module ActiveJob
18
18
  # end
19
19
  #
20
20
  # How it works:
21
- # - When the job is serialized (enqueued), the first argument is checked.
22
- # - If the argument is a Hash and its JSON representation exceeds the compression threshold,
23
- # it is compressed using zlib and base64, and marked with a special key.
24
- # - When the job is deserialized (dequeued), the argument is checked for the marker and
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
- if h["arguments"] && h["arguments"].first.is_a?(Hash)
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"][0] = decompress_if_needed(arg)
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: (Hash[String, untyped] obj) -> (Hash[String, untyped] | Hash[String, String | bool])
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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activejob-compressible
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Lee