Adds ability to temporarily cache language selection upon account creation.
This commit is contained in:
parent
54c9fe34ce
commit
9b639c4ea9
@ -32,14 +32,14 @@ celery_app = celery.current_app
|
|||||||
|
|
||||||
|
|
||||||
@celery_app.task(bind=True, base=CriticalSQLAlchemyTask)
|
@celery_app.task(bind=True, base=CriticalSQLAlchemyTask)
|
||||||
def account_creation_callback(self, result: str, url: str, status_code: int):
|
def account_creation_callback(self, result: str, param: str, status_code: int):
|
||||||
"""This function defines a task that creates a user and
|
"""This function defines a task that creates a user and
|
||||||
:param self: Reference providing access to the callback task instance.
|
:param self: Reference providing access to the callback task instance.
|
||||||
:type self: celery.Task
|
:type self: celery.Task
|
||||||
:param result: The blockchain address for the created account
|
:param result: The blockchain address for the created account
|
||||||
:type result: str
|
:type result: str
|
||||||
:param url: URL provided to callback task in cic-eth should http be used for callback.
|
:param param: URL provided to callback task in cic-eth should http be used for callback.
|
||||||
:type url: str
|
:type param: str
|
||||||
:param status_code: The status of the task to create an account
|
:param status_code: The status of the task to create an account
|
||||||
:type status_code: int
|
:type status_code: int
|
||||||
"""
|
"""
|
||||||
@ -69,6 +69,15 @@ def account_creation_callback(self, result: str, url: str, status_code: int):
|
|||||||
set_active_token(blockchain_address=result, token_symbol=token_symbol)
|
set_active_token(blockchain_address=result, token_symbol=token_symbol)
|
||||||
|
|
||||||
queue = self.request.delivery_info.get('routing_key')
|
queue = self.request.delivery_info.get('routing_key')
|
||||||
|
preferences_data = {"preferred_language": param}
|
||||||
|
# temporarily caching selected language
|
||||||
|
key = cache_data_key(bytes.fromhex(result), MetadataPointer.PREFERENCES)
|
||||||
|
cache_data(key, json.dumps(preferences_data))
|
||||||
|
s_preferences_metadata = celery.signature(
|
||||||
|
'cic_ussd.tasks.metadata.add_preferences_metadata', [result, preferences_data], queue=queue
|
||||||
|
)
|
||||||
|
s_preferences_metadata.apply_async()
|
||||||
|
|
||||||
s_phone_pointer = celery.signature(
|
s_phone_pointer = celery.signature(
|
||||||
'cic_ussd.tasks.metadata.add_phone_pointer', [result, phone_number], queue=queue
|
'cic_ussd.tasks.metadata.add_phone_pointer', [result, phone_number], queue=queue
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user