Skip to content
Snippets Groups Projects
Commit 4d93e2c6 authored by Dan Notestein's avatar Dan Notestein Committed by Bartek Wrona
Browse files

update_last_active_at even if context is already attached to avoid auto-detach race

parent 2fe59f10
No related branches found
No related tags found
1 merge request!668Changes done across v1.27.5.0-rc0 - v1.27.5.0-rc7 versions in the develop branch to be delivered to master
Subproject commit a766d5eec21735f9c1d12ee5e19a9d0defa675f5
Subproject commit ebdd31df41a55acaf6cac6accd43a27223445b42
......@@ -36,7 +36,11 @@ def context_detach(db: Db) -> None:
def context_attach(db: Db, block_number: int) -> None:
is_attached = db.query_one(f"SELECT hive.app_context_is_attached('{SCHEMA_NAME}')")
if is_attached:
log.info("Context already attached - attaching skipped.")
#Update last_active_at to avoid context being detached by auto-detacher prior to call to next_app_block.
#This is a workaround for current flaws in transaction management in hivemind, so it can be removed
#once transaction management is properly done (i.e. transactions should start/end when hivemind is consistent with a block)
db.query_no_return(f"SELECT hive.app_update_last_active_at('{SCHEMA_NAME}')");
log.info("Context already attached - attaching skipped, but last_active_at updated.")
return
log.info(f"Trying to attach app context with block number: {block_number}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment