@@ -21,9 +21,11 @@ class InclinationService:
2121 _config = Settings ()
2222
2323 def __init__ (self ):
24- # Keep lifecycle same as osw-validation; only force callback worker mode to
25- # thread by default to avoid subprocess worker exits in this runtime.
26- os .environ .setdefault ('TOPIC_CALLBACK_EXECUTION_MODE' , 'thread' )
24+ # Keep Service Bus receiver and lock renewal in the parent process while
25+ # long-running inclination work runs in a Linux forked child process.
26+ os .environ ['TOPIC_CALLBACK_EXECUTION_MODE' ] = 'process'
27+ os .environ ['TOPIC_CALLBACK_PROCESS_START_METHOD' ] = 'fork'
28+ os .environ ['TOPIC_CALLBACK_PROCESS_FALLBACK_MODE' ] = 'error'
2729
2830 self .core = Core ()
2931 self ._subscription_name = self ._config .event_bus .request_subscription
@@ -40,12 +42,17 @@ def __init__(self):
4042 def subscribe (self ) -> None :
4143 # Process the incoming message
4244 def process (message ) -> None :
43- if message is not None :
45+ try :
46+ if message is None :
47+ Logger .info (' No Message' )
48+ return
49+
4450 request_message = QueueMessage .to_dict (message )
4551 request_msg = RequestMessage .from_dict (request_message )
4652 self .process_message (request_msg )
47- else :
48- Logger .info (' No Message' )
53+ except Exception as exc :
54+ # Never let callback crash propagate; this prevents unnecessary DLQ.
55+ Logger .error (f'Unhandled callback error: { exc } ' )
4956
5057 self .request_topic .subscribe (
5158 subscription = self ._subscription_name ,
0 commit comments