aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/request/request-scheduler.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/request/request-scheduler.ts')
-rw-r--r--server/lib/request/request-scheduler.ts23
1 files changed, 13 insertions, 10 deletions
diff --git a/server/lib/request/request-scheduler.ts b/server/lib/request/request-scheduler.ts
index 26ffbfb86..69d840eeb 100644
--- a/server/lib/request/request-scheduler.ts
+++ b/server/lib/request/request-scheduler.ts
@@ -1,3 +1,5 @@
1import * as Sequelize from 'sequelize'
2
1import { database as db } from '../../initializers/database' 3import { database as db } from '../../initializers/database'
2import { BaseRequestScheduler } from './base-request-scheduler' 4import { BaseRequestScheduler } from './base-request-scheduler'
3import { logger } from '../../helpers' 5import { logger } from '../../helpers'
@@ -6,6 +8,14 @@ import {
6 REQUESTS_LIMIT_PER_POD 8 REQUESTS_LIMIT_PER_POD
7} from '../../initializers' 9} from '../../initializers'
8 10
11export type RequestSchedulerOptions = {
12 type: string
13 endpoint: string
14 data: Object
15 toIds: number[]
16 transaction: Sequelize.Transaction
17}
18
9class RequestScheduler extends BaseRequestScheduler { 19class RequestScheduler extends BaseRequestScheduler {
10 constructor () { 20 constructor () {
11 super() 21 super()
@@ -25,7 +35,7 @@ class RequestScheduler extends BaseRequestScheduler {
25 return db.RequestToPod 35 return db.RequestToPod
26 } 36 }
27 37
28 buildRequestObjects (requests) { 38 buildRequestObjects (requests: { [ toPodId: number ]: any }) {
29 const requestsToMakeGrouped = {} 39 const requestsToMakeGrouped = {}
30 40
31 Object.keys(requests).forEach(toPodId => { 41 Object.keys(requests).forEach(toPodId => {
@@ -51,14 +61,7 @@ class RequestScheduler extends BaseRequestScheduler {
51 return requestsToMakeGrouped 61 return requestsToMakeGrouped
52 } 62 }
53 63
54 // { type, endpoint, data, toIds, transaction } 64 createRequest ({ type, endpoint, data, toIds, transaction }: RequestSchedulerOptions, callback: (err: Error) => void) {
55 createRequest (options, callback) {
56 const type = options.type
57 const endpoint = options.endpoint
58 const data = options.data
59 const toIds = options.toIds
60 const transaction = options.transaction
61
62 // TODO: check the setPods works 65 // TODO: check the setPods works
63 const podIds = [] 66 const podIds = []
64 67
@@ -77,7 +80,7 @@ class RequestScheduler extends BaseRequestScheduler {
77 } 80 }
78 } 81 }
79 82
80 const dbRequestOptions = { 83 const dbRequestOptions: Sequelize.CreateOptions = {
81 transaction 84 transaction
82 } 85 }
83 86