Skip to content

Commit c676ff0

Browse files
authored
Destroy Registry Flag (#162)
This provides a public interface to destroy the DBOS class with `DBOS.destroy()` without destroying the registry of decorated functions. Useful for re-launching after failures. Addresses #160
1 parent d3cd06f commit c676ff0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

dbos/_dbos.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,13 +238,14 @@ def __new__(
238238
return _dbos_global_instance
239239

240240
@classmethod
241-
def destroy(cls) -> None:
241+
def destroy(cls, *, destroy_registry: bool = True) -> None:
242242
global _dbos_global_instance
243-
global _dbos_global_registry
244243
if _dbos_global_instance is not None:
245244
_dbos_global_instance._destroy()
246245
_dbos_global_instance = None
247-
_dbos_global_registry = None
246+
if destroy_registry:
247+
global _dbos_global_registry
248+
_dbos_global_registry = None
248249

249250
def __init__(
250251
self,

0 commit comments

Comments
 (0)