1
0
Fork 0

Fix typings

This commit is contained in:
Chocobozzz 2018-02-27 17:42:32 +01:00
parent c90f0614e6
commit 628d28e84b
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
2 changed files with 3 additions and 5 deletions

View File

@ -1,5 +1,5 @@
import * as kue from 'kue'
import { JobType, JobState } from '../../../shared/models'
import { JobState, JobType } from '../../../shared/models'
import { logger } from '../../helpers/logger'
import { CONFIG, JOB_ATTEMPTS, JOB_COMPLETED_LIFETIME, JOB_CONCURRENCY } from '../../initializers'
import { Redis } from '../redis'
@ -87,7 +87,7 @@ class JobQueue {
})
}
async listForApi (state: JobState, start: number, count: number, sort: 'ASC' | 'DESC') {
async listForApi (state: JobState, start: number, count: number, sort: 'ASC' | 'DESC'): Promise<kue.Job[]> {
const jobStrings = await Redis.Instance.listJobs(this.jobRedisPrefix, state, 'alpha', sort, start, count)
const jobPromises = jobStrings
@ -149,7 +149,7 @@ class JobQueue {
}
private getJob (id: number) {
return new Promise((res, rej) => {
return new Promise<kue.Job>((res, rej) => {
kue.Job.get(id, (err, job) => {
if (err) return rej(err)

View File

@ -59,8 +59,6 @@ class Redis {
this.client.sort(jobsPrefix + ':jobs:' + state, 'by', mode, order, 'LIMIT', offset.toString(), count.toString(), (err, values) => {
if (err) return rej(err)
return res(values)
})
})