Skip to content

Conversation

@hdbjeff
Copy link
Contributor

@hdbjeff hdbjeff commented Nov 26, 2025

Provided a detailed description of how to determine when the eviction cycle will run based on the scanInterval setting.

Copy link
Member

@Ethan-Arrowood Ethan-Arrowood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I really understand the description here. It could use clearer examples I think.

- `eviction` - The amount of time after expiration before a record can be evicted (defaults to zero).
- `scanInterval` - The interval for scanning for expired records (defaults to one quarter of the total of expiration and eviction).

How often records are evicted is based on the `scanInterval` setting. Using Javascript's `setHours` method, we divide days and years by the interval in the local timezone of the Harper server to find the specific times to run at, regardless of the start time of the Harper server. For example, if the Harper server started at 1205 and the table `expiration` was set to 1 hour, with the default `scanInterval` (here being 15 minutes, one quarter of the TTL) eviction would run at 1215, 1230, 1245, 1300 etc. If the Harper server started at 1205pm and the `expiration` was set to 1 day, with the default `scanInterval` (now of 6 hours) the eviction would run at 1800 the same day, 0000 and 0600 the next day, etc.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is "JavaScript's setHours method"? This: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/setHours ?

Furthermore, I feel like this description is missing something. I understand the start time doesn't have any impact, so then what does? Would a server that started at any time and an expiration of 1 day also have an eviction at 1800 the same day? What if my server started after 1800?

Copy link
Member

@heskew heskew Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something more like this (easier to scan and remove impl detail)?

- `scanInterval` - The interval for scanning for expired records, in seconds (defaults to 1/4 of the total of expiration and eviction).

**Scan Alignment Examples**:
- 1-hour expiration, default interval (15 min): :00, :15, :30, :45 each hour
- 6-hour expiration, default interval (90 min): 00:00, 01:30, 03:00, 04:30, 06:00, 07:30... 
- 1-day expiration, default interval (6 hours): 00:00, 06:00, 12:00, 18:00 daily
- 1-day expiration, custom 8-hour interval: 00:00, 08:00, 16:00 daily

Scans occur at these clock times in the server's local timezone, regardless of when the server started.

@hdbjeff
Copy link
Contributor Author

hdbjeff commented Nov 27, 2025

  • Added additional clarity to specify "anchor times" - thinking this might make more sense.
  • Removed references to the setHours() - yes, that is the method but don't think it is important to call out here.
  • Included some example schedules to better demonstrate the fixed times in relation to server startup times.

Copy link
Member

@Ethan-Arrowood Ethan-Arrowood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

amazing. love it!

@hdbjeff hdbjeff merged commit a8e0f6d into main Dec 3, 2025
5 checks passed
@hdbjeff hdbjeff deleted the update-scanInterval-description branch December 3, 2025 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants