failure interrupts victim even if the victim is empty

parent b8dd7f5e
......@@ -87,8 +87,7 @@ class Failure(ObjectInterruption):
def run(self):
while 1:
yield hold,self,self.rngTTF.generateNumber() # wait until a failure happens
if(len(self.getVictimQueue())>0): # when a Machine gets failure
self.interruptVictim() # while in process it is interrupted
self.interruptVictim() # interrupt the victim
self.victim.Up=False
self.victim.timeLastFailure=now()
self.outputTrace("is down")
......@@ -103,11 +102,9 @@ class Failure(ObjectInterruption):
yield hold,self,self.rngTTR.generateNumber() # wait until the repairing process is over
self.victim.totalFailureTime+=now()-failTime
if(len(self.getVictimQueue())>0):
self.reactivateVictim() # since repairing is over, the Machine is reactivated
self.reactivateVictim() # since repairing is over, the Machine is reactivated
self.victim.Up=True
self.outputTrace("is up")
self.outputTrace("is up")
if(self.repairman and self.repairman!="None"): #if a resource was used, it is now released
yield release,self,self.repairman.getResource()
self.repairman.totalWorkingTime+=now()-timeOperationStarted
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment