-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feat/DEX-2853/item-caching' into 'master'
[DEX-2853] feat: failed item caching Closes DEX-2853 See merge request nstmrt/rubygems/outbox!116
- Loading branch information
Showing
11 changed files
with
374 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# frozen_string_literal: true | ||
|
||
module Sbmt | ||
module Outbox | ||
module V2 | ||
class RedisItemMeta | ||
attr_reader :version, :timestamp, :errors_count, :error_msg | ||
|
||
CURRENT_VERSION = 1 | ||
MAX_ERROR_LEN = 200 | ||
|
||
def initialize(errors_count:, error_msg:, timestamp: Time.current.to_i, version: CURRENT_VERSION) | ||
@errors_count = errors_count | ||
@error_msg = error_msg | ||
@timestamp = timestamp | ||
@version = version | ||
end | ||
|
||
def to_s | ||
serialize | ||
end | ||
|
||
def serialize | ||
JSON.generate({ | ||
version: version, | ||
timestamp: timestamp, | ||
errors_count: errors_count, | ||
error_msg: error_msg.slice(0, MAX_ERROR_LEN) | ||
}) | ||
end | ||
|
||
def self.deserialize!(value) | ||
raise "invalid data type: string is required" unless value.is_a?(String) | ||
|
||
data = JSON.parse!(value, max_nesting: 1) | ||
new( | ||
version: data["version"], | ||
timestamp: data["timestamp"].to_i, | ||
errors_count: data["errors_count"].to_i, | ||
error_msg: data["error_msg"] | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Sbmt | ||
module Outbox | ||
VERSION = "6.17.0" | ||
VERSION = "6.18.0" | ||
end | ||
end |
Oops, something went wrong.