Skip to content

Commit

Permalink
feat: refactor lua script
Browse files Browse the repository at this point in the history
  • Loading branch information
YoussefAWasfy committed Sep 23, 2024
1 parent ef5a1ce commit cf046ca
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions affinidi-messaging-mediator/src/database/atm-functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,8 @@ local function get_status_reply(keys, args)
-- Get the oldest and newest message information
local r = redis.pcall('XINFO', 'STREAM', 'RECEIVE_Q:' .. keys[1])
if r['err'] == nil and r.map then
if r.map['first-entry'] then
response.map.oldest_received = r.map['first-entry'][1]
else
response.map.oldest_received = 0
end

if r.map['last-entry'] then
response.map.newest_received = r.map['last-entry'][1]
else
response.map.newest_received = 0
end
response.map.oldest_received = r.map['first-entry'] and r.map['first-entry'][1] or 0
response.map.newest_received = r.map['last-entry'] and r.map['last-entry'][1] or 0
response.map.queue_count = r.map['length']
end

Expand Down

0 comments on commit cf046ca

Please sign in to comment.