Comment 3 for bug 1548135

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to zaqar (master)

Reviewed: https://review.openstack.org/314273
Committed: https://git.openstack.org/cgit/openstack/zaqar/commit/?id=48f3e9f9a284b6f979bc0ba770146208164e0c8e
Submitter: Jenkins
Branch: master

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.

    Closes-Bug: 1548135
    Change-Id: Iedd2b82f6da30dd38bfdbb837bf9d0d4c282e222