diff --git a/README.md b/README.md index 01b6b32..eea258a 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ N_GSPS: The number of gsps you want to pull INCLUDE_NATIONAL: Option to load national data, or not UK_LONDON_HOUR: Optional to check UK London hour. This means can run this service at the same UTC times, independently of the clock change. +BACKFILL_HOURS: Optional, defaults to 2. The amount of hours of data that is backfilled. These options can also be enter like this: ``` diff --git a/gspconsumer/app.py b/gspconsumer/app.py index c9c0c07..e2ca202 100644 --- a/gspconsumer/app.py +++ b/gspconsumer/app.py @@ -145,7 +145,8 @@ def pull_data_and_save( datetime_utc = datetime.utcnow().replace(tzinfo=timezone.utc) # add timezone if regime == "in-day": - start = datetime_utc - timedelta(hours=1) + backfill_hours = os.getenv("BACKFILL_HOURS", 2) + start = datetime_utc - timedelta(hours=backfill_hours) end = datetime_utc + timedelta(minutes=30) else: start = datetime_utc.replace(hour=0, minute=0, second=0, microsecond=0) - timedelta(