From 49e92874c30d28e68dd579e245d53d587e07a8ab Mon Sep 17 00:00:00 2001 From: nolash Date: Wed, 7 Apr 2021 15:44:50 +0200 Subject: [PATCH] Clean phone index reply --- apps/contract-migration/scripts/task.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/contract-migration/scripts/task.py b/apps/contract-migration/scripts/task.py index 34ec7a56..1e4e1a44 100644 --- a/apps/contract-migration/scripts/task.py +++ b/apps/contract-migration/scripts/task.py @@ -3,6 +3,7 @@ import logging import urllib.parse import urllib.error import urllib.request +import json # external imports import celery @@ -23,7 +24,8 @@ class MetadataTask(celery.Task): urllib.error.HTTPError, ) retry_kwargs = { - 'countdown': 1, + 'countdown': 3, + 'max_retries': 100, } @classmethod @@ -40,4 +42,11 @@ def resolve_phone(self, phone): url = urllib.parse.urljoin(self.meta_url(), identifier) logg.debug('attempt getting phone pointer at {}'.format(url)) r = urllib.request.urlopen(url) - logg.debug('phone pointer result {}'.format(r)) + address = json.load(r) + logg.debug('address {} for phone {}'.format(address, phone)) + + +@celery_app.task(bind=True, base=MetadataTask) +def transfer_opening_balance(self, phone, address): + pass +