mirror of
https://github.com/Paris-est-Ludique/intranet.git
synced 2025-06-09 00:54:21 +02:00
Removes debug artefacts
This commit is contained in:
parent
cdb6f1c3fe
commit
a8c65b2e33
@ -16,7 +16,6 @@ export default function DBManager<OperationReturn>(): any {
|
|||||||
const operations: Operation[] = []
|
const operations: Operation[] = []
|
||||||
|
|
||||||
async function addDBOperation(type: OperationType, task: () => Promise<OperationReturn>) {
|
async function addDBOperation(type: OperationType, task: () => Promise<OperationReturn>) {
|
||||||
console.log(`New ${type} DB Operation in line.`)
|
|
||||||
return new Promise(
|
return new Promise(
|
||||||
(resolve: (value: OperationReturn) => void, reject: (reason: unknown) => void) => {
|
(resolve: (value: OperationReturn) => void, reject: (reason: unknown) => void) => {
|
||||||
operations.push({ task, type, resolve, reject })
|
operations.push({ task, type, resolve, reject })
|
||||||
@ -29,7 +28,6 @@ export default function DBManager<OperationReturn>(): any {
|
|||||||
|
|
||||||
function runNextDBOperation(): void {
|
function runNextDBOperation(): void {
|
||||||
operations.shift()
|
operations.shift()
|
||||||
console.log("DB Operation completed.")
|
|
||||||
if (operations[0]) {
|
if (operations[0]) {
|
||||||
runOperation(operations[0])
|
runOperation(operations[0])
|
||||||
}
|
}
|
||||||
@ -40,11 +38,9 @@ export default function DBManager<OperationReturn>(): any {
|
|||||||
if (type === "list") {
|
if (type === "list") {
|
||||||
const now = +new Date()
|
const now = +new Date()
|
||||||
if (now < cacheTime + CACHE_RENEW_DELAY) {
|
if (now < cacheTime + CACHE_RENEW_DELAY) {
|
||||||
console.log("Using cache")
|
|
||||||
resolve(cache)
|
resolve(cache)
|
||||||
runNextDBOperation()
|
runNextDBOperation()
|
||||||
} else {
|
} else {
|
||||||
console.log("Refreshing cache")
|
|
||||||
task()
|
task()
|
||||||
.then((val: OperationReturn) => {
|
.then((val: OperationReturn) => {
|
||||||
cache = val
|
cache = val
|
||||||
|
Loading…
x
Reference in New Issue
Block a user