Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NC | NSFS] use fixed hh:mm for running expiry script #7952

Merged

Conversation

tangledbytes
Copy link
Member

Explain the changes

This PR moves away from running expiry script on certain interval and instead use a configurable hh:mm or when the disk is running low on space.

The granularity is minutes instead of seconds to account for scheduler mess ups.

  • Doc added/updated
  • Tests added

@tangledbytes tangledbytes changed the title [NC | NSFS] move away from running expiry on interval - use fixed hh:mm [NC | NSFS] use fixed hh:mm for running expiry script Apr 4, 2024
@tangledbytes tangledbytes requested a review from guymguym April 4, 2024 12:56
@tangledbytes tangledbytes force-pushed the utkarsh/feat/run-expiry-hh-mm branch from 7aa83d7 to 10c9698 Compare April 8, 2024 09:00
config.js Show resolved Hide resolved
@tangledbytes tangledbytes force-pushed the utkarsh/feat/run-expiry-hh-mm branch from 10c9698 to c07d67d Compare April 10, 2024 09:33
@tangledbytes tangledbytes requested a review from guymguym April 10, 2024 09:34
config.js Outdated Show resolved Hide resolved
config.js Outdated Show resolved Hide resolved
@tangledbytes tangledbytes force-pushed the utkarsh/feat/run-expiry-hh-mm branch 2 times, most recently from 863f8a3 to c534023 Compare April 10, 2024 13:07
src/manage_nsfs/manage_nsfs_glacier.js Outdated Show resolved Hide resolved
Comment on lines 111 to 126
if (config.NSFS_GLACIER_EXPIRY_TZ === 'UTC') {
min_time.setUTCHours(desired_hour);
min_time.setUTCMinutes(desired_min);
} else {
min_time.setHours(desired_hour);
min_time.setMinutes(desired_min);
}

const max_time = new Date();
if (config.NSFS_GLACIER_EXPIRY_TZ === 'UTC') {
max_time.setUTCHours(desired_hour);
max_time.setUTCMinutes(desired_min + tolerate_mins);
} else {
max_time.setHours(desired_hour);
max_time.setMinutes(desired_min + tolerate_mins);
}
Copy link
Member

Choose a reason for hiding this comment

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

can you refactor this to a utility function to avoid copy-pasta issues?

Copy link
Member

Choose a reason for hiding this comment

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

also don't we need to set the seconds and millis to 0?

Copy link
Member Author

Choose a reason for hiding this comment

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

I have set the secs to 0 now but not millis. Considering the granularity is minutes, does it matter?

Copy link
Member

Choose a reason for hiding this comment

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

I would prefer it to be clear and not have random millis.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

src/manage_nsfs/manage_nsfs_glacier.js Outdated Show resolved Hide resolved
@tangledbytes tangledbytes force-pushed the utkarsh/feat/run-expiry-hh-mm branch from c534023 to 84d6ca5 Compare April 10, 2024 13:29
@pull-request-size pull-request-size bot added size/L and removed size/M labels Apr 10, 2024
@tangledbytes tangledbytes force-pushed the utkarsh/feat/run-expiry-hh-mm branch 2 times, most recently from b22e7b4 to 0e5d583 Compare April 10, 2024 13:30
@tangledbytes tangledbytes requested a review from guymguym April 10, 2024 13:34
Copy link
Member

@guymguym guymguym left a comment

Choose a reason for hiding this comment

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

looks good, but i would still zero the millis.

Signed-off-by: Utkarsh Srivastava <srivastavautkarsh8097@gmail.com>

address PR comments

Signed-off-by: Utkarsh Srivastava <srivastavautkarsh8097@gmail.com>

set millis to 0

Signed-off-by: Utkarsh Srivastava <srivastavautkarsh8097@gmail.com>
@tangledbytes tangledbytes force-pushed the utkarsh/feat/run-expiry-hh-mm branch from 0e5d583 to 90a2fa6 Compare April 10, 2024 14:18
@tangledbytes tangledbytes merged commit 175a2a0 into noobaa:master Apr 10, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants