"""SQL failure at result publication must be retry, followed by lease recovery.""" import hashlib import json import time from common import * def main(): c=Client(BASE);alice,bob,eve,chat=c.bootstrap() dc('stop','-t','2','worker') response=c.call('POST','/api/v1/chats/'+chat['id']+'/attachments?filename=db-retry.png',202, actor=alice,raw=(ROOT/'tests/fixtures/sample.png').read_bytes(),headers={'Content-Type':'image/png'},schema='Attachment') tid=response['headers']['X-Trace-Id'];att=response['json'] lock=DBLock();lock.start('attachment_variants') before=snapshot();start=time.time() try: dc('start','worker') deadline=time.monotonic()+30 while time.monotonic()