Skip to content

Commit

Permalink
Ajouter le paramètre "time_before_reinscription"
Browse files Browse the repository at this point in the history
Ce commit ajoute un nouveau paramètre "time_before_reinscription" pour ajuster le temps maximum de réenregistrement de l'agent machine.
Cet événement se produit lorsque le substitut indique sa présence (passant de l'état OFF à ON).
La machine est tenue de se réenregistrer dans les "time_before_reinscription" secondes spécifiées.
La valeur minimale de ce paramètre est de 30 secondes.

(cherry picked from commit 6021fc9)
  • Loading branch information
jfkneib authored and neoclust committed Mar 22, 2024
1 parent d1e6bfe commit 742b217
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 2 deletions.
5 changes: 4 additions & 1 deletion pulse_xmpp_agent/agentxmpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,10 @@ def __init__(
logging.debug("Network Changing disable")

if self.config.agenttype not in ["relayserver"]:
self.schedule("check_subscribe", 900, self.check_subscribe, repeat=True)
self.schedule("check_subscribe",
self.time_before_reinscription,
self.check_subscribe,
repeat=True)
if self.config.sched_send_ping_kiosk:
self.schedule(
"send_ping",
Expand Down
3 changes: 2 additions & 1 deletion pulse_xmpp_agent/config/agentconf.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ relayserver_agent =
# Time before trying a connection to an alternate ARS in the cluster
# By default a random is picked between 2 and 30 seconds
# alternativetimedelta = [2,30]

# minimun value 30 seconde
time_before_reinscription = 30
[type]
# The agent type: machine or relayserver
agent_type = machine
Expand Down
19 changes: 19 additions & 0 deletions pulse_xmpp_agent/lib/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,25 @@ def __init__(self, typeconf="machine"):
else:
self.detectiontime = 300

if self.agenttype == "machine":
self.time_before_reinscription = 900
if Config.has_option("global", "time_before_reinscription"):
try:
self.time_before_reinscription = Config.getint(
"global", "time_before_reinscription"
)
except Exception as e:
logger.warning(
"parameter [global] time_before_reinscription :(%s)" % str(e)
)
logger.warning(
"parameter [global] time_before_reinscription"
" : parameter set to 900"
)
self.time_before_reinscription = 900
if self.time_before_reinscription < 30:
self.time_before_reinscription = 30

self.parametersscriptconnection = {}

if self.agenttype == "relayserver":
Expand Down

0 comments on commit 742b217

Please sign in to comment.