|
|
@ -74,15 +74,15 @@ func timeToCrawl(ctx context.Context, objAPI ObjectLayer) time.Duration { |
|
|
|
if dataUsageInfo.LastUpdate.IsZero() { |
|
|
|
if dataUsageInfo.LastUpdate.IsZero() { |
|
|
|
return 1 * time.Second |
|
|
|
return 1 * time.Second |
|
|
|
} |
|
|
|
} |
|
|
|
waitDuration := dataUsageInfo.LastUpdate.Sub(UTCNow()) |
|
|
|
timeSinceLastUpdate := UTCNow().Sub(dataUsageInfo.LastUpdate) |
|
|
|
if waitDuration > dataUsageCrawlInterval { |
|
|
|
if timeSinceLastUpdate > dataUsageCrawlInterval { |
|
|
|
// Waited long enough start crawl in a 1 second
|
|
|
|
// Waited long enough start crawl in a 1 second
|
|
|
|
return 1 * time.Second |
|
|
|
return 1 * time.Second |
|
|
|
} |
|
|
|
} |
|
|
|
// No crawling needed, ask the routine to wait until
|
|
|
|
// No crawling needed, ask the routine to wait until
|
|
|
|
// the daily interval 12hrs - delta between last update
|
|
|
|
// the daily interval 12hrs - delta between last update
|
|
|
|
// with current time.
|
|
|
|
// with current time.
|
|
|
|
return dataUsageCrawlInterval - waitDuration |
|
|
|
return dataUsageCrawlInterval - timeSinceLastUpdate |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var dataUsageLockTimeout = lifecycleLockTimeout |
|
|
|
var dataUsageLockTimeout = lifecycleLockTimeout |
|
|
|