Implement transaction handling
This commit is contained in:
@@ -16,11 +16,20 @@ INTERVALS_PLATFORM = [x[0] for x in INTERVAL_CHOICES]
|
||||
|
||||
|
||||
async def aggregator_job():
|
||||
aggregators = Aggregator.objects.filter(enabled=True, fetch_accounts=True)
|
||||
aggregators = Aggregator.objects.filter(enabled=True)
|
||||
for aggregator in aggregators:
|
||||
if aggregator.service == "nordigen":
|
||||
instance = await NordigenClient(aggregator)
|
||||
await instance.get_all_account_info(store=True)
|
||||
if aggregator.fetch_accounts is True:
|
||||
await instance.get_all_account_info(store=True)
|
||||
|
||||
fetch_tasks = []
|
||||
for bank, accounts in aggregator.account_info.items():
|
||||
for account in accounts:
|
||||
account_id = account["account_id"]
|
||||
task = instance.get_transactions(account_id, process=True)
|
||||
fetch_tasks.append(task)
|
||||
await asyncio.gather(*fetch_tasks)
|
||||
else:
|
||||
raise NotImplementedError(f"No such client library: {aggregator.service}")
|
||||
aggregator.fetch_accounts = False
|
||||
|
||||
Reference in New Issue
Block a user