Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task celery #7238

Merged
merged 1 commit into from
Aug 14, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions app/kudos/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ def mint_token_request(self, token_req_id, retry=False):
self.retry(countdown=(30 * (self.request.retries + 1)))


@app.shared_task(bind=True, max_retries=10, soft_time_limit=300, time_limit=400)
@app.shared_task(bind=True, max_retries=10, soft_time_limit=30, time_limit=60)
def redeem_bulk_kudos(self, kt_id, retry=False):
"""
:param self:
:param kt_id:
:return:
"""
with redis.lock("tasks:all_kudos_requests", timeout=LOCK_TIMEOUT):
with redis.lock("tasks:redeem_bulk_kudos:%s" % kt_id, timeout=LOCK_TIMEOUT):
try:
try:
with redis.lock("tasks:all_kudos_requests", timeout=LOCK_TIMEOUT):
with redis.lock("tasks:redeem_bulk_kudos:%s" % kt_id, timeout=LOCK_TIMEOUT):
multiplier = 1
gas_price = int(float(recommend_min_gas_price_to_confirm_in_time(1)) * multiplier)
if gas_price > delay_if_gas_prices_gt_redeem and self.request.retries < self.max_retries:
Expand Down Expand Up @@ -95,11 +95,11 @@ def redeem_bulk_kudos(self, kt_id, retry=False):
while not has_tx_mined(obj.txid, obj.network):
time.sleep(1)
pass
except SoftTimeLimitExceeded:
print('max timeout for bulk kudos redeem exceeded ... giving up!')
except Exception as e:
print(e)
if self.request.retries < self.max_retries:
self.retry(countdown=(30 * (self.request.retries + 1)))
else:
print("max retries for bulk kudos redeem exceeded ... giving up!")
except SoftTimeLimitExceeded:
print('max timeout for bulk kudos redeem exceeded ... giving up!')
except Exception as e:
print(e)
if self.request.retries < self.max_retries:
self.retry(countdown=(30 * (self.request.retries + 1)))
else:
print("max retries for bulk kudos redeem exceeded ... giving up!")