idempotency_lock 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3472cab3f3ed5118fb6b5843141d81c215efd5d0c7c7f1a12e88e3989a10315e
4
- data.tar.gz: e070c49739921f73928eecc9ad94b97ce316c6cef1f4357ea109e211360c5ca5
3
+ metadata.gz: 88b6cc80e37f3db005c446a96005520945b141ef45f1ff4d90863975de52ed45
4
+ data.tar.gz: 43adf42af7496edc68cf46590fc2d09d585214c44dcd57487d0c290161f4af72
5
5
  SHA512:
6
- metadata.gz: adf210196f47721787c1bc87e22de3c83ec787cf0b2f9c5b2a630e52aa610ee86c3e1124c19e2cea0401fbfc92a6ebcc795d94a735539eec55d57967e6ab70a1
7
- data.tar.gz: b85bc4c3e9d4713d3e75bbe0032964d746e5eccc13b185937bfcf66617e8542c390414920e8478429812198f5680ef03ce28f07482c017b15e9c9a8a8053120e
6
+ metadata.gz: 989d09faf1a493cf14ee9426c4ffa67275a761e5784072164a0b3e24f9f3202a0424308f9621cace94e2245707ae25d936b96349a8798dfd5bb2b38656529b7c
7
+ data.tar.gz: '084463272e767a8579dde4848d1a386645119404d65c608ee5d2960940963e877dbeaa3ed4c481679e6d5e14811cdeabeee2427a906571e2db9ea1366baf7344'
data/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.1.2] - 2025-12-06
4
+
5
+ ### Fixed
6
+
7
+ - Migration now works with MySQL (uses regular index instead of partial index,
8
+ which MySQL doesn't support)
9
+
10
+ ### Added
11
+
12
+ - `Result#inspect` for easier debugging
13
+
3
14
  ## [0.1.1] - 2025-12-06
4
15
 
5
16
  ### Fixed
data/README.md CHANGED
@@ -186,7 +186,7 @@ The gem creates an `idempotency_locks` table with:
186
186
 
187
187
  Indexes:
188
188
  - Unique index on `name` (provides atomicity)
189
- - Partial index on `expires_at` where not null (for efficient TTL queries)
189
+ - Index on `expires_at` (partial index on PostgreSQL/SQLite, regular index on MySQL)
190
190
 
191
191
  **Note on name length:** Lock names are limited to 255 characters to ensure compatibility with database unique index limits. MySQL users with `utf8mb4` encoding may need to reduce this to 191 characters by modifying the migration before running it.
192
192
 
@@ -13,7 +13,14 @@ class CreateIdempotencyLocks < ActiveRecord::Migration<%= migration_version %>
13
13
  end
14
14
 
15
15
  add_index :idempotency_locks, :name, unique: true
16
- add_index :idempotency_locks, :expires_at, where: "expires_at IS NOT NULL"
16
+
17
+ # Partial indexes are more efficient but not supported by MySQL.
18
+ # Use a regular index for MySQL, partial index for PostgreSQL/SQLite.
19
+ if ActiveRecord::Base.connection.adapter_name.downcase.include?("mysql")
20
+ add_index :idempotency_locks, :expires_at
21
+ else
22
+ add_index :idempotency_locks, :expires_at, where: "expires_at IS NOT NULL"
23
+ end
17
24
  end
18
25
  end
19
26
 
@@ -40,5 +40,14 @@ module IdempotencyLock
40
40
  def success?
41
41
  @executed && !error?
42
42
  end
43
+
44
+ # @return [String] human-readable representation for debugging
45
+ def inspect
46
+ parts = ["executed=#{@executed}"]
47
+ parts << "skipped=#{@skipped}" if @skipped
48
+ parts << "value=#{@value.inspect}" if @value
49
+ parts << "error=#{@error.class}" if @error
50
+ "#<IdempotencyLock::Result #{parts.join(" ")}>"
51
+ end
43
52
  end
44
53
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module IdempotencyLock
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: idempotency_lock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nagro