Skip to content

Commit

Permalink
able to force restart fire_hire()
Browse files Browse the repository at this point in the history
  • Loading branch information
vesellov committed May 3, 2024
1 parent 9131811 commit 83fd2a8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
11 changes: 11 additions & 0 deletions bitdust/customer/fire_hire.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
_FireHire = None
_LastFireTime = 0
_SuppliersToFire = []
_ForceRestartState = False

#-------------------------------------------------------------------------

Expand All @@ -168,6 +169,11 @@ def AddSupplierToFire(idurl):
_SuppliersToFire.append(idurl)


def ForceRestart():
global _ForceRestartState
_ForceRestartState = True


def IsAllHired():
if settings.getSuppliersNumberDesired() < 0:
# I must know how many suppliers I want
Expand Down Expand Up @@ -423,6 +429,9 @@ def isConfigChanged(self, *args, **kwargs):
"""
Condition method.
"""
global _ForceRestartState
if _ForceRestartState:
return True
return self._is_config_changed()

def isContractExpiring(self, *args, **kwargs):
Expand Down Expand Up @@ -453,6 +462,8 @@ def doConnectSuppliers(self, *args, **kwargs):
"""
Action method.
"""
global _ForceRestartState
_ForceRestartState = False
from bitdust.customer import supplier_connector
from bitdust.p2p import online_status
self.connect_list = []
Expand Down
2 changes: 2 additions & 0 deletions bitdust/interface/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1709,6 +1709,8 @@ def files_sync():
if _Debug:
lg.out(_DebugLevel, 'api.files_sync')
from bitdust.storage import backup_monitor
from bitdust.customer import fire_hire
fire_hire.ForceRestart()
backup_monitor.A('restart')
if _Debug:
lg.out(_DebugLevel, 'api.files_sync')
Expand Down

0 comments on commit 83fd2a8

Please sign in to comment.