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