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