diff options
Diffstat (limited to 'server/lib')
-rw-r--r-- | server/lib/job-queue/job-queue.ts | 2 | ||||
-rw-r--r-- | server/lib/redis.ts | 27 |
2 files changed, 28 insertions, 1 deletions
diff --git a/server/lib/job-queue/job-queue.ts b/server/lib/job-queue/job-queue.ts index 4cda12b57..53d6b6a9c 100644 --- a/server/lib/job-queue/job-queue.ts +++ b/server/lib/job-queue/job-queue.ts | |||
@@ -8,6 +8,7 @@ import { | |||
8 | ActivitypubHttpFetcherPayload, | 8 | ActivitypubHttpFetcherPayload, |
9 | ActivitypubHttpUnicastPayload, | 9 | ActivitypubHttpUnicastPayload, |
10 | ActorKeysPayload, | 10 | ActorKeysPayload, |
11 | DeleteResumableUploadMetaFilePayload, | ||
11 | EmailPayload, | 12 | EmailPayload, |
12 | JobState, | 13 | JobState, |
13 | JobType, | 14 | JobType, |
@@ -52,6 +53,7 @@ type CreateJobArgument = | |||
52 | { type: 'video-live-ending', payload: VideoLiveEndingPayload } | | 53 | { type: 'video-live-ending', payload: VideoLiveEndingPayload } | |
53 | { type: 'actor-keys', payload: ActorKeysPayload } | | 54 | { type: 'actor-keys', payload: ActorKeysPayload } | |
54 | { type: 'video-redundancy', payload: VideoRedundancyPayload } | | 55 | { type: 'video-redundancy', payload: VideoRedundancyPayload } | |
56 | { type: 'delete-resumable-upload-meta-file', payload: DeleteResumableUploadMetaFilePayload } | | ||
55 | { type: 'move-to-object-storage', payload: MoveObjectStoragePayload } | 57 | { type: 'move-to-object-storage', payload: MoveObjectStoragePayload } |
56 | 58 | ||
57 | export type CreateJobOptions = { | 59 | export type CreateJobOptions = { |
diff --git a/server/lib/redis.ts b/server/lib/redis.ts index d1d88d853..46617b07e 100644 --- a/server/lib/redis.ts +++ b/server/lib/redis.ts | |||
@@ -9,7 +9,8 @@ import { | |||
9 | USER_PASSWORD_CREATE_LIFETIME, | 9 | USER_PASSWORD_CREATE_LIFETIME, |
10 | VIEW_LIFETIME, | 10 | VIEW_LIFETIME, |
11 | WEBSERVER, | 11 | WEBSERVER, |
12 | TRACKER_RATE_LIMITS | 12 | TRACKER_RATE_LIMITS, |
13 | RESUMABLE_UPLOAD_SESSION_LIFETIME | ||
13 | } from '../initializers/constants' | 14 | } from '../initializers/constants' |
14 | import { CONFIG } from '../initializers/config' | 15 | import { CONFIG } from '../initializers/config' |
15 | 16 | ||
@@ -202,6 +203,30 @@ class Redis { | |||
202 | ]) | 203 | ]) |
203 | } | 204 | } |
204 | 205 | ||
206 | /* ************ Resumable uploads final responses ************ */ | ||
207 | |||
208 | setUploadSession (uploadId: string, response?: { video: { id: number, shortUUID: string, uuid: string } }) { | ||
209 | return this.setValue( | ||
210 | 'resumable-upload-' + uploadId, | ||
211 | response | ||
212 | ? JSON.stringify(response) | ||
213 | : '', | ||
214 | RESUMABLE_UPLOAD_SESSION_LIFETIME | ||
215 | ) | ||
216 | } | ||
217 | |||
218 | doesUploadSessionExist (uploadId: string) { | ||
219 | return this.exists('resumable-upload-' + uploadId) | ||
220 | } | ||
221 | |||
222 | async getUploadSession (uploadId: string) { | ||
223 | const value = await this.getValue('resumable-upload-' + uploadId) | ||
224 | |||
225 | return value | ||
226 | ? JSON.parse(value) | ||
227 | : '' | ||
228 | } | ||
229 | |||
205 | /* ************ Keys generation ************ */ | 230 | /* ************ Keys generation ************ */ |
206 | 231 | ||
207 | generateCachedRouteKey (req: express.Request) { | 232 | generateCachedRouteKey (req: express.Request) { |