MCPcopy Create free account
hub / github.com/HKUDS/OpenSpace / close

Method close

openspace/skill_engine/store.py:280–297  ·  view source on GitHub ↗

Close the persistent connection. Subsequent ops will raise. Performs a WAL checkpoint before closing so that all committed data is flushed from the WAL file into the main ``.db`` file. This ensures external tools (DB browsers, backup scripts) see complete data withou

(self)

Source from the content-addressed store, hash-verified

278
279 # Lifecycle
280 def close(self) -> None:
281 """Close the persistent connection. Subsequent ops will raise.
282
283 Performs a WAL checkpoint before closing so that all committed
284 data is flushed from the WAL file into the main ``.db`` file.
285 This ensures external tools (DB browsers, backup scripts) see
286 complete data without needing to understand SQLite WAL mode.
287 """
288 if self._closed:
289 return
290 self._closed = True
291 try:
292 # Flush WAL → main DB so external readers see all data
293 self._conn.execute("PRAGMA wal_checkpoint(TRUNCATE)")
294 self._conn.close()
295 except Exception:
296 pass
297 logger.debug("SkillStore closed (WAL checkpointed)")
298
299 async def __aenter__(self):
300 return self

Callers 8

__aexit__Method · 0.95
mainFunction · 0.95
cleanupMethod · 0.45
_readerMethod · 0.45
stopMethod · 0.45
stopMethod · 0.45
close_windowMethod · 0.45

Calls 1

executeMethod · 0.45

Tested by

no test coverage detected