You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
627 B
23 lines
627 B
import {Queue} from './Queue'
|
|
import {Inject, Injectable} from '../../../di'
|
|
import {Logging} from '../../../service/Logging'
|
|
import {Queueable, ShouldQueue} from '../types'
|
|
import {Maybe} from '../../../util'
|
|
|
|
/**
|
|
* Simple queue implementation that executes items immediately in the current process.
|
|
*/
|
|
@Injectable()
|
|
export class SyncQueue extends Queue {
|
|
@Inject()
|
|
protected readonly logging!: Logging
|
|
|
|
protected async push<T extends Queueable>(item: ShouldQueue<T>): Promise<void> {
|
|
await item.execute()
|
|
}
|
|
|
|
async pop(): Promise<Maybe<ShouldQueue<Queueable>>> {
|
|
return undefined
|
|
}
|
|
}
|