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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 88b6cc80e37f3db005c446a96005520945b141ef45f1ff4d90863975de52ed45
|
|
4
|
+
data.tar.gz: 43adf42af7496edc68cf46590fc2d09d585214c44dcd57487d0c290161f4af72
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
-
|
|
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
|
-
|
|
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
|