concurrent trigger list modification fix

This commit is contained in:
Tim Olson
2023-11-05 18:10:05 -04:00
parent 73bb0fd635
commit 6a5bba1078

View File

@@ -215,7 +215,7 @@ async def activate_time_triggers():
now = current_block.get().timestamp now = current_block.get().timestamp
log.debug(f'activating time triggers') log.debug(f'activating time triggers')
# time triggers # time triggers
for tt in time_triggers: for tt in tuple(time_triggers):
await maywait(tt(now)) await maywait(tt(now))
async def activate_price_triggers(): async def activate_price_triggers():
@@ -223,14 +223,14 @@ async def activate_price_triggers():
pools_triggered = set() pools_triggered = set()
for pool, price in new_pool_prices.items(): for pool, price in new_pool_prices.items():
pools_triggered.add(pool) pools_triggered.add(pool)
for pt in price_triggers[pool]: for pt in tuple(price_triggers[pool]):
await maywait(pt(price)) await maywait(pt(price))
for pool, triggers in new_price_triggers.items(): for pool, triggers in new_price_triggers.items():
if pool not in pools_triggered: if pool not in pools_triggered:
price = pool_prices[pool] price = pool_prices[pool]
for pt in triggers: for pt in triggers:
await maywait(pt(price)) await maywait(pt(price))
for t in unconstrained_price_triggers: for t in tuple(unconstrained_price_triggers):
# noinspection PyTypeChecker # noinspection PyTypeChecker
await maywait(t(None)) await maywait(t(None))