Skip to content

Commit

Permalink
Merge pull request #1038 from SEKOIA-IO/refactor/GoogleReport
Browse files Browse the repository at this point in the history
Google: Change the end of the period to call when restarting the connector
  • Loading branch information
squioc authored Jul 23, 2024
2 parents 0ef266f + c077e7a commit 3baa050
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 6 additions & 0 deletions Google/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## 2024-07-22 - 1.20.6

### Fixed

- Change the way to catch back the delay with the timestepper

## 2024-07-02 - 1.20.5

### Changed
Expand Down
14 changes: 5 additions & 9 deletions Google/google_module/google_reports.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,13 @@ def stepper(self):
if most_recent_date_seen < six_months_ago:
most_recent_date_seen = six_months_ago

return TimeStepper.create_from_time(
timeshift = timedelta(minutes=self.configuration.timedelta)
return TimeStepper(
self,
most_recent_date_seen,
self.configuration.frequency,
self.configuration.timedelta,
now - timeshift, # Set the end of the period to the now minus the temporal shift
timedelta(seconds=self.configuration.frequency),
timeshift,
)

@stepper.setter
Expand Down Expand Up @@ -168,12 +170,6 @@ def run(self):
duration = int(time.time() - duration_start)
FORWARD_EVENTS_DURATION.labels(intake_key=self.configuration.intake_key).observe(duration)

# Compute the remaining sleeping time
delta_sleep = self.configuration.frequency - duration
# if greater than 0, sleep
if delta_sleep > 0:
time.sleep(delta_sleep)

finally:
self.log(
message="Failed to forward events from Google Reports API",
Expand Down
2 changes: 1 addition & 1 deletion Google/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,5 @@
"name": "Google",
"uuid": "4f682a9e-9a25-43a5-8a48-cd9bd7fade7e",
"slug": "google",
"version": "1.20.5"
"version": "1.20.6"
}

0 comments on commit 3baa050

Please sign in to comment.