Skip to content

Commit

Permalink
generator: watch: use max startTime from events
Browse files Browse the repository at this point in the history
  • Loading branch information
blueyed committed Dec 2, 2018
1 parent 5c033ca commit 4cecb2e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion awslogs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ def generator():

while True:
response = self.client.filter_log_events(**kwargs)
events = response.get('events', [])

for event in response.get('events', []):
for event in events:
if event['eventId'] not in interleaving_sanity:
interleaving_sanity.append(event['eventId'])
yield event
Expand All @@ -162,6 +163,13 @@ def generator():
time.sleep(self.watch_interval)
if 'nextToken' in kwargs:
del kwargs['nextToken']

if events:
kwargs['startTime'] = max(
event['timestamp'] for event in events
)
assert kwargs['startTime'] == events[-1]['timestamp']

else:
raise StopIteration

Expand Down

0 comments on commit 4cecb2e

Please sign in to comment.