blob: e75e9ddf00b9f0eac0f096e6b2e3a3c22e7b915f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
from operationscore.Behavior import *
class Timeout(Behavior):
"""Timeout is a behavior designed to be used in recursive hooks to stop responses after a certain
amount of time. It is the Time-version of RecursiveDecay. Specify:
<TimeOut> -- the time in ms that the response will run.
"""
def processResponse(self, sensorInputs, recur):
ret = []
for data in sensorInputs:
if not 'StartTime' in data:
data['StartTime'] = timeops.time()
if timeops.time()-data['StartTime'] < self['Timeout']:
ret.append(data)
return (ret, [])
|