Merge pull request #19596 from qrGitHub/wip-rgw-lc-scheduleNextStartTime

rgw: optimize next start time for lifecycle

Reviewed-by: Daniel Gryniewicz <dang@redhat.com>
This commit is contained in:
Casey Bodley 2018-01-25 10:19:21 -05:00 committed by GitHub
commit c42f7632b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -794,8 +794,10 @@ bool RGWLC::LCWorker::should_work(utime_t& now)
int RGWLC::LCWorker::schedule_next_start_time(utime_t &start, utime_t& now)
{
int secs;
if (cct->_conf->rgw_lc_debug_interval > 0) {
int secs = start + cct->_conf->rgw_lc_debug_interval - now;
secs = start + cct->_conf->rgw_lc_debug_interval - now;
if (secs < 0)
secs = 0;
return (secs);
@ -815,8 +817,9 @@ int RGWLC::LCWorker::schedule_next_start_time(utime_t &start, utime_t& now)
bdt.tm_min = start_minute;
bdt.tm_sec = 0;
nt = mktime(&bdt);
secs = nt - tt;
return (nt+24*60*60 - tt);
return secs>0 ? secs : secs+24*60*60;
}
void RGWLifecycleConfiguration::generate_test_instances(list<RGWLifecycleConfiguration*>& o)