mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-09-11 13:37:10 +03:00
Handle 410 HTTP response code for AP objects
This commit is contained in:
parent
8d4902b3ba
commit
6a4db88e5c
@ -57,8 +57,10 @@ async function doRefresh <T extends MActorFull | MActorAccountChannelId> (option
|
|||||||
|
|
||||||
return { refreshed: true, actor }
|
return { refreshed: true, actor }
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
|
const statusCode = (err as PeerTubeRequestError).statusCode
|
||||||
logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url, lTags())
|
|
||||||
|
if (statusCode === HttpStatusCode.NOT_FOUND_404 || statusCode === HttpStatusCode.GONE_410) {
|
||||||
|
logger.info('Deleting actor %s because there is a 404/410 in refresh actor.', actor.url, lTags())
|
||||||
|
|
||||||
actor.Account
|
actor.Account
|
||||||
? await actor.Account.destroy()
|
? await actor.Account.destroy()
|
||||||
|
@ -33,8 +33,10 @@ async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner)
|
|||||||
|
|
||||||
return videoPlaylist
|
return videoPlaylist
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
|
const statusCode = (err as PeerTubeRequestError).statusCode
|
||||||
logger.info('Cannot refresh not existing playlist %s. Deleting it.', videoPlaylist.url, lTags())
|
|
||||||
|
if (statusCode === HttpStatusCode.NOT_FOUND_404 || statusCode === HttpStatusCode.GONE_410) {
|
||||||
|
logger.info('Cannot refresh not existing playlist (404/410 error code) %s. Deleting it.', videoPlaylist.url, lTags())
|
||||||
|
|
||||||
await videoPlaylist.destroy()
|
await videoPlaylist.destroy()
|
||||||
return undefined
|
return undefined
|
||||||
|
@ -43,8 +43,10 @@ async function refreshVideoIfNeeded (options: {
|
|||||||
|
|
||||||
return video
|
return video
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
|
const statusCode = (err as PeerTubeRequestError).statusCode
|
||||||
logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url, lTags())
|
|
||||||
|
if (statusCode === HttpStatusCode.NOT_FOUND_404 || statusCode === HttpStatusCode.GONE_410) {
|
||||||
|
logger.info('Cannot refresh remote video %s: video does not exist anymore (404/410 error code). Deleting it.', video.url, lTags())
|
||||||
|
|
||||||
// Video does not exist anymore
|
// Video does not exist anymore
|
||||||
await video.destroy()
|
await video.destroy()
|
||||||
|
Loading…
Reference in New Issue
Block a user