3131 Ipv4Address , NameList , Payload , StatisticsTypes ,
3232 GroupConfigInfo , ProgramConfig , SupvisorsProcessConfig )
3333
34+ # Constants
35+ SYNCHRO_TIMEOUT_MIN = 0
36+ SYNCHRO_LIST_TIMEOUT_MIN = 15
37+ SYNCHRO_TIMEOUT_MAX = 1200
38+
3439
3540# Options of main section
3641def get_logger_configuration (** config ) -> Payload :
@@ -65,7 +70,7 @@ class SupvisorsOptions:
6570 - multicast_interface: UDP Multicast Group interface ;
6671 - multicast_ttl: UDP Multicast time-to-live ;
6772 - rules_files: list of absolute or relative paths to the XML rules files ;
68- - css_files: list of css files used to override the Supvisors default CSS ;
73+ - css_files: list of CSS files used to override the Supvisors default CSS ;
6974 - event_link: type of the event link used to publish all Supvisors events ;
7075 - event_port: port number used to publish all Supvisors events ;
7176 - auto_fence: when True, Supvisors won't try to reconnect to a Supvisors instance that has been inactive ;
@@ -88,9 +93,6 @@ class SupvisorsOptions:
8893 - tailf_limit: the number of bytes used to display the log tail of the file in the Web UI (tail -f mode).
8994 """
9095
91- SYNCHRO_TIMEOUT_MIN = 15
92- SYNCHRO_TIMEOUT_MAX = 1200
93-
9496 # default SynchronizationOptions list that is equivalent to previous Supvisors versions
9597 SYNCHRO_DEFAULT_OPTIONS = [SynchronizationOptions .STRICT ,
9698 SynchronizationOptions .TIMEOUT ,
@@ -132,7 +134,7 @@ def __init__(self, supervisord, logger: Logger, **config):
132134 self .auto_fence = self ._get_value (config , 'auto_fence' , False , boolean )
133135 self .synchro_options = self ._get_value (config , 'synchro_options' , self .SYNCHRO_DEFAULT_OPTIONS ,
134136 self .to_synchro_options )
135- self .synchro_timeout = self ._get_value (config , 'synchro_timeout' , self . SYNCHRO_TIMEOUT_MIN , self .to_timeout )
137+ self .synchro_timeout = self ._get_value (config , 'synchro_timeout' , SYNCHRO_LIST_TIMEOUT_MIN , self .to_timeout )
136138 self .inactivity_ticks = self ._get_value (config , 'inactivity_ticks' , self .INACTIVITY_TICKS_MIN , self .to_ticks )
137139 # get the minimum list of identifiers to end the synchronization phase
138140 self .core_identifiers = self ._get_value (config , 'core_identifiers' , set (),
@@ -212,10 +214,10 @@ def check_options(self):
212214 ' with no core_identifiers' )
213215 self .synchro_options .remove (SynchronizationOptions .CORE )
214216 # when using LIST in synchro_options, supvisors_list cannot be empty
215- if not self .supvisors_list and SynchronizationOptions .STRICT in self .synchro_options :
216- self .logger .warn ('SupvisorsOptions:check_options: cancellation of synchro_options STRICT'
217- ' with no supvisors_list' )
218- self .synchro_options .remove (SynchronizationOptions .STRICT )
217+ # if not self.supvisors_list and SynchronizationOptions.STRICT in self.synchro_options:
218+ # self.logger.warn('SupvisorsOptions:check_options: cancellation of synchro_options STRICT'
219+ # ' with no supvisors_list')
220+ # self.synchro_options.remove(SynchronizationOptions.STRICT)
219221 # synchro_options must not be empty
220222 if not self .synchro_options :
221223 raise ValueError ('synchro_options shall not be empty' )
@@ -226,6 +228,13 @@ def check_options(self):
226228 self .logger .warn ('SupvisorsOptions:check_options: force supvisors_failure_strategy=CONTINUE'
227229 ' because it is incompatible with synchro_options=TIMEOUT' )
228230 self .supvisors_failure_strategy = SupvisorsFailureStrategies .CONTINUE
231+ # use a minimum timeout of 15 seconds when LIST is in synchro_options to give a chance to discovered instances
232+ #if (SynchronizationOptions.LIST in self.synchro_options
233+ # and SynchronizationOptions.TIMEOUT in self.synchro_options
234+ # and self.synchro_timeout < SYNCHRO_LIST_TIMEOUT_MIN):
235+ # self.logger.warn(f'SupvisorsOptions:check_options: force synchro_timeout={SYNCHRO_LIST_TIMEOUT_MIN}'
236+ # ' to give a chance with synchro_options=TIMEOUT')
237+ # self.synchro_timeout = SYNCHRO_LIST_TIMEOUT_MIN
229238
230239 def check_dirpath (self , file_path : str ) -> str :
231240 """ Check if the path provided exists and create the folder tree if necessary.
@@ -418,20 +427,20 @@ def to_synchro_options(value: str) -> List[SynchronizationOptions]:
418427
419428 @staticmethod
420429 def to_timeout (value : str ) -> int :
421- """ Convert a string into a timeout value, in [15 ;1200].
430+ """ Convert a string into a timeout value, in [0 ;1200].
422431
423- :param value: the timeout as a string
424- :return: the timeout as an integer
432+ :param value: the timeout as a string.
433+ :return: the timeout as an integer.
425434 """
426435 try :
427436 timeout = integer (value )
428- if SupvisorsOptions . SYNCHRO_TIMEOUT_MIN > timeout or timeout > SupvisorsOptions . SYNCHRO_TIMEOUT_MAX :
437+ if SYNCHRO_TIMEOUT_MIN > timeout or timeout > SYNCHRO_TIMEOUT_MAX :
429438 raise ValueError
430439 return timeout
431440 except ValueError :
432441 raise ValueError (f'invalid value for synchro_timeout: "{ value } ".'
433- f' integer expected in [{ SupvisorsOptions . SYNCHRO_TIMEOUT_MIN } ;'
434- f'{ SupvisorsOptions . SYNCHRO_TIMEOUT_MAX } ] (seconds)' )
442+ f' integer expected in [{ SYNCHRO_TIMEOUT_MIN } ;'
443+ f'{ SYNCHRO_TIMEOUT_MAX } ] (seconds)' )
435444
436445 @staticmethod
437446 def to_ticks (value : str ) -> int :
0 commit comments