Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ def snapshot_and_read(self):

def _get_push_interval_config(self):
config = CLIConfig(config_dir=self._config_dir)
threshold = config.getint('telemetry', 'push_interval_in_hours', fallback=6)
# the threshold for push telemetry can't be less than 1 hour, default value is 6 hours
return threshold if threshold >= 1 else 6
threshold = config.getint('telemetry', 'push_interval_in_hours', fallback=1)
# the threshold for push telemetry can't be less than 1 hour, default value is 1 hour
return threshold if threshold >= 1 else 1

def _read_file(self, path):
""" Read content of a telemetry cache file and parse them into records. """
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ def test_create_records_collection(self):
self.assertEqual(1758, len([r for r in collection]))

def test_create_records_collection_with_last_send(self):
last_send = datetime.datetime.now() - datetime.timedelta(hours=2)
last_send = datetime.datetime.now() - datetime.timedelta(minutes=20)
collection = RecordsCollection(last_send, self.work_dir)
collection.snapshot_and_read()

# the threshold for pushing 'cache' file is 6, so 'cache' file should not be moved
# the threshold for pushing 'cache' file is 1 hour, so 'cache' file should not be moved
self.assert_cache_files_count(1)
# no new records since last_send
self.assertEqual(0, len([r for r in collection]))
Expand Down