Skip to content

Commit c22665c

Browse files
authored
Call now() once so start and end have exactly the same base timestamp. (#36574)
1 parent 944eef9 commit c22665c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

sdks/python/apache_beam/transforms/periodicsequence.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,8 +337,7 @@ def expand(self, pbegin):
337337
if self.rebase == RebaseMode.REBASE_ALL:
338338
duration = Timestamp.of(self.stop_ts) - Timestamp.of(self.start_ts)
339339
impulse_element = pbegin | beam.Impulse() | beam.Map(
340-
lambda _:
341-
[Timestamp.now(), Timestamp.now() + duration, self.interval])
340+
lambda _: [now := Timestamp.now(), now + duration, self.interval])
342341
elif self.rebase == RebaseMode.REBASE_START:
343342
impulse_element = pbegin | beam.Impulse() | beam.Map(
344343
lambda _: [Timestamp.now(), self.stop_ts, self.interval])

0 commit comments

Comments
 (0)