aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2017-11-15 16:28:35 +0100
committerChocobozzz <florian.bigard@gmail.com>2017-11-27 19:40:52 +0100
commit8e10cf1a5a438a00e5f7e0691cb830769867cffc (patch)
tree23c0aeb43d7fb05b2d280c37b4334c2f320b647e /server/lib
parent8e13fa7d09e9925b4559cbba6c5d72c5ff1bd391 (diff)
downloadPeerTube-8e10cf1a5a438a00e5f7e0691cb830769867cffc.tar.gz
PeerTube-8e10cf1a5a438a00e5f7e0691cb830769867cffc.tar.zst
PeerTube-8e10cf1a5a438a00e5f7e0691cb830769867cffc.zip
Fix video upload and videos list
Diffstat (limited to 'server/lib')
-rw-r--r--server/lib/activitypub/send-request.ts7
-rw-r--r--server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts3
-rw-r--r--server/lib/jobs/http-request-job-scheduler/http-request-unicast-handler.ts3
-rw-r--r--server/lib/jobs/job-scheduler.ts4
-rw-r--r--server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts2
5 files changed, 13 insertions, 6 deletions
diff --git a/server/lib/activitypub/send-request.ts b/server/lib/activitypub/send-request.ts
index 1a6cebc03..1dad51828 100644
--- a/server/lib/activitypub/send-request.ts
+++ b/server/lib/activitypub/send-request.ts
@@ -11,6 +11,7 @@ import { signObject, activityPubContextify } from '../../helpers'
11import { Activity } from '../../../shared' 11import { Activity } from '../../../shared'
12import { VideoAbuseInstance } from '../../models/video/video-abuse-interface' 12import { VideoAbuseInstance } from '../../models/video/video-abuse-interface'
13import { getActivityPubUrl } from '../../helpers/activitypub' 13import { getActivityPubUrl } from '../../helpers/activitypub'
14import { logger } from '../../helpers/logger'
14 15
15async function sendCreateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) { 16async function sendCreateVideoChannel (videoChannel: VideoChannelInstance, t: Sequelize.Transaction) {
16 const videoChannelObject = videoChannel.toActivityPubObject() 17 const videoChannelObject = videoChannel.toActivityPubObject()
@@ -100,7 +101,11 @@ export {
100// --------------------------------------------------------------------------- 101// ---------------------------------------------------------------------------
101 102
102async function broadcastToFollowers (data: any, fromAccount: AccountInstance, t: Sequelize.Transaction) { 103async function broadcastToFollowers (data: any, fromAccount: AccountInstance, t: Sequelize.Transaction) {
103 const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi(fromAccount.id, 0) 104 const result = await db.AccountFollow.listAcceptedFollowerUrlsForApi(fromAccount.id)
105 if (result.data.length === 0) {
106 logger.info('Not broadcast because of 0 followers.')
107 return
108 }
104 109
105 const jobPayload = { 110 const jobPayload = {
106 uris: result.data, 111 uris: result.data,
diff --git a/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts b/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts
index 2f1d9ee92..ccb008e4d 100644
--- a/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts
+++ b/server/lib/jobs/http-request-job-scheduler/http-request-broadcast-handler.ts
@@ -22,8 +22,9 @@ function onError (err: Error, jobId: number) {
22 return Promise.resolve() 22 return Promise.resolve()
23} 23}
24 24
25async function onSuccess (jobId: number) { 25function onSuccess (jobId: number) {
26 logger.info('Job %d is a success.', jobId) 26 logger.info('Job %d is a success.', jobId)
27 return Promise.resolve()
27} 28}
28 29
29// --------------------------------------------------------------------------- 30// ---------------------------------------------------------------------------
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
index 3a1a7fabf..9e4e73891 100644
--- 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
@@ -20,8 +20,9 @@ function onError (err: Error, jobId: number) {
20 return Promise.resolve() 20 return Promise.resolve()
21} 21}
22 22
23async function onSuccess (jobId: number) { 23function onSuccess (jobId: number) {
24 logger.info('Job %d is a success.', jobId) 24 logger.info('Job %d is a success.', jobId)
25 return Promise.resolve()
25} 26}
26 27
27// --------------------------------------------------------------------------- 28// ---------------------------------------------------------------------------
diff --git a/server/lib/jobs/job-scheduler.ts b/server/lib/jobs/job-scheduler.ts
index b25bb7ab3..73c440279 100644
--- a/server/lib/jobs/job-scheduler.ts
+++ b/server/lib/jobs/job-scheduler.ts
@@ -9,7 +9,7 @@ import { error } from 'util'
9export interface JobHandler<P, T> { 9export interface JobHandler<P, T> {
10 process (data: object, jobId: number): Promise<T> 10 process (data: object, jobId: number): Promise<T>
11 onError (err: Error, jobId: number) 11 onError (err: Error, jobId: number)
12 onSuccess (jobId: number, jobResult: T, jobScheduler: JobScheduler<P, T>) 12 onSuccess (jobId: number, jobResult: T, jobScheduler: JobScheduler<P, T>): Promise<any>
13} 13}
14type JobQueueCallback = (err: Error) => void 14type JobQueueCallback = (err: Error) => void
15 15
@@ -127,7 +127,7 @@ class JobScheduler<P, T> {
127 127
128 try { 128 try {
129 await job.save() 129 await job.save()
130 jobHandler.onSuccess(job.id, jobResult, this) 130 await jobHandler.onSuccess(job.id, jobResult, this)
131 } catch (err) { 131 } catch (err) {
132 this.cannotSaveJobError(err) 132 this.cannotSaveJobError(err)
133 } 133 }
diff --git a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts
index d3ee886e7..f6d9627a5 100644
--- a/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts
+++ b/server/lib/jobs/transcoding-job-scheduler/video-file-optimizer-handler.ts
@@ -39,8 +39,8 @@ async function onSuccess (jobId: number, video: VideoInstance, jobScheduler: Job
39 await sendAddVideo(video, undefined) 39 await sendAddVideo(video, undefined)
40 40
41 const originalFileHeight = await videoDatabase.getOriginalFileHeight() 41 const originalFileHeight = await videoDatabase.getOriginalFileHeight()
42 // Create transcoding jobs if there are enabled resolutions
43 42
43 // Create transcoding jobs if there are enabled resolutions
44 const resolutionsEnabled = computeResolutionsToTranscode(originalFileHeight) 44 const resolutionsEnabled = computeResolutionsToTranscode(originalFileHeight)
45 logger.info( 45 logger.info(
46 'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, originalFileHeight, 46 'Resolutions computed for video %s and origin file height of %d.', videoDatabase.uuid, originalFileHeight,