()
| 51 | |
| 52 | let needsCleanup = true |
| 53 | async function runVerySlowOps(): Promise<void> { |
| 54 | // If the user did something in the last minute, don't make them wait for these slow operations to run. |
| 55 | if ( |
| 56 | getIsInteractive() && |
| 57 | getLastInteractionTime() > Date.now() - 1000 * 60 |
| 58 | ) { |
| 59 | setTimeout( |
| 60 | runVerySlowOps, |
| 61 | DELAY_VERY_SLOW_OPERATIONS_THAT_HAPPEN_EVERY_SESSION, |
| 62 | ).unref() |
| 63 | return |
| 64 | } |
| 65 | |
| 66 | if (needsCleanup) { |
| 67 | needsCleanup = false |
| 68 | await cleanupOldMessageFilesInBackground() |
| 69 | } |
| 70 | |
| 71 | // If the user did something in the last minute, don't make them wait for these slow operations to run. |
| 72 | if ( |
| 73 | getIsInteractive() && |
| 74 | getLastInteractionTime() > Date.now() - 1000 * 60 |
| 75 | ) { |
| 76 | setTimeout( |
| 77 | runVerySlowOps, |
| 78 | DELAY_VERY_SLOW_OPERATIONS_THAT_HAPPEN_EVERY_SESSION, |
| 79 | ).unref() |
| 80 | return |
| 81 | } |
| 82 | |
| 83 | await cleanupOldVersions() |
| 84 | } |
| 85 | |
| 86 | setTimeout( |
| 87 | runVerySlowOps, |
nothing calls this directly
no test coverage detected