change the log replayer to be more realistic
This commit is contained in:
parent
4616a600fe
commit
2779bac01a
|
@ -36,8 +36,12 @@ class FakeEvent:
|
|||
def as_dict(self):
|
||||
return self._ev_dict
|
||||
|
||||
prev_ev = None
|
||||
for line in open(json_file):
|
||||
d = json.loads(line.strip())
|
||||
ev = FakeEvent(d)
|
||||
events.report_event(ev)
|
||||
time.sleep(random.expovariate(2))
|
||||
if prev_ev is not None:
|
||||
events.report_event(prev_ev)
|
||||
time.sleep(min((ev.timestamp - prev_ev.timestamp)/4, 2))
|
||||
prev_ev = ev
|
||||
events.report_event(prev_ev)
|
||||
|
|
Loading…
Reference in New Issue