Improve logging when cannot fetch remote videos
This commit is contained in:
parent
b4b3e77d10
commit
8e8234abba
1 changed files with 10 additions and 5 deletions
|
@ -177,7 +177,9 @@ async function getOrCreateVideo (videoObject: VideoTorrentObject, channelActor:
|
||||||
|
|
||||||
async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentObject | string, actor?: ActorModel) {
|
async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentObject | string, actor?: ActorModel) {
|
||||||
if (typeof videoObject === 'string') {
|
if (typeof videoObject === 'string') {
|
||||||
const videoFromDatabase = await VideoModel.loadByUrlAndPopulateAccount(videoObject)
|
const videoUrl = videoObject
|
||||||
|
|
||||||
|
const videoFromDatabase = await VideoModel.loadByUrlAndPopulateAccount(videoUrl)
|
||||||
if (videoFromDatabase) {
|
if (videoFromDatabase) {
|
||||||
return {
|
return {
|
||||||
video: videoFromDatabase,
|
video: videoFromDatabase,
|
||||||
|
@ -186,8 +188,8 @@ async function getOrCreateAccountAndVideoAndChannel (videoObject: VideoTorrentOb
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
videoObject = await fetchRemoteVideo(videoObject)
|
videoObject = await fetchRemoteVideo(videoUrl)
|
||||||
if (!videoObject) throw new Error('Cannot fetch remote video (maybe invalid...)')
|
if (!videoObject) throw new Error('Cannot fetch remote video with url: ' + videoUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!actor) {
|
if (!actor) {
|
||||||
|
@ -268,9 +270,12 @@ async function addVideoShares (instance: VideoModel, shareUrls: string[]) {
|
||||||
json: true,
|
json: true,
|
||||||
activityPub: true
|
activityPub: true
|
||||||
})
|
})
|
||||||
const actorUrl = body.actor
|
if (!body || !body.actor) {
|
||||||
if (!actorUrl) continue
|
logger.warn('Cannot add remote share with url: %s, skipping...', shareUrl)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const actorUrl = body.actor
|
||||||
const actor = await getOrCreateActorAndServerAndModel(actorUrl)
|
const actor = await getOrCreateActorAndServerAndModel(actorUrl)
|
||||||
|
|
||||||
const entry = {
|
const entry = {
|
||||||
|
|
Loading…
Reference in a new issue