mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2024-08-17 09:20:26 +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 }
|
||||
} catch (err) {
|
||||
if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
|
||||
logger.info('Deleting actor %s because there is a 404 in refresh actor.', actor.url, lTags())
|
||||
const statusCode = (err as PeerTubeRequestError).statusCode
|
||||
|
||||
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
|
||||
? await actor.Account.destroy()
|
||||
|
@ -33,8 +33,10 @@ async function refreshVideoPlaylistIfNeeded (videoPlaylist: MVideoPlaylistOwner)
|
||||
|
||||
return videoPlaylist
|
||||
} catch (err) {
|
||||
if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
|
||||
logger.info('Cannot refresh not existing playlist %s. Deleting it.', videoPlaylist.url, lTags())
|
||||
const statusCode = (err as PeerTubeRequestError).statusCode
|
||||
|
||||
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()
|
||||
return undefined
|
||||
|
@ -43,8 +43,10 @@ async function refreshVideoIfNeeded (options: {
|
||||
|
||||
return video
|
||||
} catch (err) {
|
||||
if ((err as PeerTubeRequestError).statusCode === HttpStatusCode.NOT_FOUND_404) {
|
||||
logger.info('Cannot refresh remote video %s: video does not exist anymore. Deleting it.', video.url, lTags())
|
||||
const statusCode = (err as PeerTubeRequestError).statusCode
|
||||
|
||||
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
|
||||
await video.destroy()
|
||||
|
Loading…
Reference in New Issue
Block a user