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

Rotate existing not rotating at correct interval #18

Open
Zacharias3690 opened this issue Mar 28, 2018 · 1 comment
Open

Rotate existing not rotating at correct interval #18

Zacharias3690 opened this issue Mar 28, 2018 · 1 comment
Labels

Comments

@Zacharias3690
Copy link

When a file is less than 24 hours old (daily), initialPeriodCheck fails to trigger new file creation. Next Rotation time checks 24 hours since birthtime instead of at midnight of the day after birthtime, causing no new file to be created at startup.

Relevant code:

//  initialperiodtrigger.js
function checkIfRotationNeeded(birthtime, now) {
    var nextRot = birthtime;
    var lastRot = birthtime;
    while (nextRot < now) {
        lastRot = nextRot;
        nextRot = nextRotTime(lastRot, periodScope, periodNum);
    }

    return { needsRotation: lastRot != birthtime, rotateTo: lastRot };
}
// nextrotationtime.js
case 'd':
    if (rotAt) {
        newRotAt = rotAt + periodNum * 24 * 60 * 60 * 1000;
    } else {
        // First time: start of tomorrow (i.e. at the coming midnight) UTC.
        newRotAt = Date.UTC(d.getUTCFullYear(), d.getUTCMonth(),
            d.getUTCDate() + 1);
    }
    break;  

e.g. if file is created at 11:30am Mar 28, rotAt is passed in as 11:30am Mar 28, and newRotAt returns 11:30am Mar 29, so if the time is after Midnight on Mar 29, but before 11:30am, no new file is created.

From looking at the code it looks like this issue will be with hourly and weekly as well.

@Rcomian Rcomian added the bug label Mar 29, 2018
@gopal-abbineni
Copy link

Facing the same issue for ms as well... do we have any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants