PeerTube/server/lib/jobs/http-request-job-scheduler/http-request-job-scheduler.ts

23 lines
660 B
TypeScript
Raw Normal View History

2017-11-09 10:51:58 -06:00
import { JobScheduler, JobHandler } from '../job-scheduler'
import * as httpRequestBroadcastHandler from './http-request-broadcast-handler'
import * as httpRequestUnicastHandler from './http-request-unicast-handler'
import { JobCategory } from '../../../../shared'
2017-11-10 10:27:49 -06:00
type HTTPRequestPayload = {
uris: string[]
body: any
}
const jobHandlers: { [ handlerName: string ]: JobHandler<HTTPRequestPayload, void> } = {
2017-11-09 10:51:58 -06:00
httpRequestBroadcastHandler,
httpRequestUnicastHandler
}
const jobCategory: JobCategory = 'http-request'
const httpRequestJobScheduler = new JobScheduler(jobCategory, jobHandlers)
export {
2017-11-10 10:27:49 -06:00
HTTPRequestPayload,
2017-11-09 10:51:58 -06:00
httpRequestJobScheduler
}