aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-17 11:35:10 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commitafffe98839db7ccbfa9fb8b7d1413b97900fdc73 (patch)
treef0b3cbe58f73e81a5ba4bb31dabd9691994cf2ca /server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts
parent1b3989b0961d22a5a45ad16239e3c3f58f66180c (diff)
downloadPeerTube-afffe98839db7ccbfa9fb8b7d1413b97900fdc73.tar.gz
PeerTube-afffe98839db7ccbfa9fb8b7d1413b97900fdc73.tar.zst
PeerTube-afffe98839db7ccbfa9fb8b7d1413b97900fdc73.zip
Speed up activity pub http requests
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.ts34
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 @@
1import { logger } from '../../../helpers'
2import { doRequest } from '../../../helpers/requests'
3import { HTTPRequestPayload } from './http-request-job-scheduler'
4
5async 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
18function onError (err: Error, jobId: number) {
19 logger.error('Error when sending request in job %d.', jobId, err)
20 return Promise.resolve()
21}
22
23function onSuccess (jobId: number) {
24 logger.info('Job %d is a success.', jobId)
25 return Promise.resolve()
26}
27
28// ---------------------------------------------------------------------------
29
30export {
31 process,
32 onError,
33 onSuccess
34}