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

Use full disk - recycle. (never delete) #213

Open
captainerd opened this issue May 28, 2022 · 0 comments
Open

Use full disk - recycle. (never delete) #213

captainerd opened this issue May 28, 2022 · 0 comments
Labels
enhancement New feature or request

Comments

@captainerd
Copy link

Is your feature request related to a problem? Please describe.
no.

Describe the solution you'd like
Using full disk with periodically checks in order to delete the oldest video to make more space than 5gb
(assuming 5gb is a safe-space for OS. updates etc)

Describe alternatives you've considered
Altering a few lines at the cleartimer.js at the line 62 and bellow? i will provide an example.

` if (recRemoveAfter) {
const recordings = Cleartimer.#recordingsDB.chain.get('recordings').cloneDeep().value();

    //will need to check free space later.
    const recPath = Cleartimer.#recordingsDB.chain.get('path').cloneDeep().value();

    //Change the (for loop) array to loop with shorting from lowest unix timestamp first to higher (oldest)  

    for (const recording of recordings.sort(({ timestamp: a }, { timestamp: b }) => a - b)) {


      //Recycle option? considering frontend hides 100days for this. (time == 100)

      if (recRemoveAfter == 100) {
        //update available disk space?
        let diskSpace = await checkDiskSpace(recPath);

        //if we left less than 5gb free space, remove that file if still less than 5gb
        if ((Math.round(diskSpace.free / 1e9) < 5)) {
          Cleartimer.#recordingsTimer.set(recording.id, false);
          await Cleartimer.#clearRecording(recording.id);
        }




      } else {
        let timestampNow = moment();.................................................................`

Additional context
Im not sure how often this is called in order to work smoothly and how these timers actually work , i would like an explenation tho.

@captainerd captainerd added the enhancement New feature or request label May 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant