diff options
Diffstat (limited to 'server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts')
-rw-r--r-- | server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts | 34 |
1 files changed, 0 insertions, 34 deletions
diff --git a/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts b/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts deleted file mode 100644 index 9e4e73891..000000000 --- a/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | import { logger } from '../../../helpers' | ||
2 | import { doRequest } from '../../../helpers/requests' | ||
3 | import { HTTPRequestPayload } from './http-request-job-scheduler' | ||
4 | |||
5 | async function process (payload: HTTPRequestPayload, jobId: number) { | ||
6 | logger.info('Processing unicast in job %d.', jobId) | ||
7 | |||
8 | const uri = payload.uris[0] | ||
9 | const options = { | ||
10 | method: 'POST', | ||
11 | uri, | ||
12 | json: payload.body | ||
13 | } | ||
14 | |||
15 | await doRequest(options) | ||
16 | } | ||
17 | |||
18 | function onError (err: Error, jobId: number) { | ||
19 | logger.error('Error when sending request in job %d.', jobId, err) | ||
20 | return Promise.resolve() | ||
21 | } | ||
22 | |||
23 | function onSuccess (jobId: number) { | ||
24 | logger.info('Job %d is a success.', jobId) | ||
25 | return Promise.resolve() | ||
26 | } | ||
27 | |||
28 | // --------------------------------------------------------------------------- | ||
29 | |||
30 | export { | ||
31 | process, | ||
32 | onError, | ||
33 | onSuccess | ||
34 | } | ||