commit 48f3e9f9a284b6f979bc0ba770146208164e0c8e
Author: Eva Balycheva <email address hidden>
Date: Sun May 8 04:42:53 2016 +0300
Fix fail of claim after some message expire(Redis)
If some messages in Redis are already expired, it's impossible to claim
any new messages.
Zaqar internally catches this error from running "claim_messages.lua":
"ResponseError: Error running script: @user_script:59: user_script:59:
attempt to compare nil with number". And returns 503 response code to
the user.
This happens because if some message is expired (it's <message_id>
record was automatically deleted from database), it's ID is still listed
in set "<project_id>.<queue_name>.messages" and Zaqar uses this ID. In
this case on attempt to get some values from <message_id>'s fields, it
gets 'nil' values.
This patch makes Zaqar check if returned field values from <message_id>
record are 'nil'. If values are not 'nil', process the record normally.
If values are 'nil', remember message ID. In the end of the script
"claim_messages.lua" garbage collect all such message IDs, because it's
a good opportunity to do so.
Reviewed: https:/ /review. openstack. org/314273 /git.openstack. org/cgit/ openstack/ zaqar/commit/ ?id=48f3e9f9a28 4b6f979bc0ba770 146208164e0c8e
Committed: https:/
Submitter: Jenkins
Branch: master
commit 48f3e9f9a284b6f 979bc0ba7701462 08164e0c8e
Author: Eva Balycheva <email address hidden>
Date: Sun May 8 04:42:53 2016 +0300
Fix fail of claim after some message expire(Redis)
If some messages in Redis are already expired, it's impossible to claim
any new messages.
Zaqar internally catches this error from running "claim_ messages. lua":
"ResponseError: Error running script: @user_script:59: user_script:59:
attempt to compare nil with number". And returns 503 response code to
the user.
This happens because if some message is expired (it's <message_id> id>.<queue_ name>.messages" and Zaqar uses this ID. In
record was automatically deleted from database), it's ID is still listed
in set "<project_
this case on attempt to get some values from <message_id>'s fields, it
gets 'nil' values.
This patch makes Zaqar check if returned field values from <message_id> messages. lua" garbage collect all such message IDs, because it's
record are 'nil'. If values are not 'nil', process the record normally.
If values are 'nil', remember message ID. In the end of the script
"claim_
a good opportunity to do so.
Closes-Bug: 1548135 d38bfdbb837bf9d 0d4c282e222
Change-Id: Iedd2b82f6da30d