1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 02:39:33 +02:00

Avoid making retried requests to dead followers

This commit is contained in:
Chocobozzz 2018-01-12 10:02:11 +01:00
parent 9a8cbd8278
commit 6502c3d43e
No known key found for this signature in database
GPG key ID: 583A612D890159BE
7 changed files with 44 additions and 3 deletions

View file

@ -163,6 +163,34 @@ export class ActorFollowModel extends Model<ActorFollowModel> {
return ActorFollowModel.findOne(query)
}
static loadByFollowerInbox (url: string, t?: Sequelize.Transaction) {
const query = {
where: {
state: 'accepted'
},
include: [
{
model: ActorModel,
required: true,
as: 'ActorFollower',
where: {
[Sequelize.Op.or]: [
{
inboxUrl: url
},
{
sharedInboxUrl: url
}
]
}
}
],
transaction: t
} as any // FIXME: typings does not work
return ActorFollowModel.findOne(query)
}
static listFollowingForApi (id: number, start: number, count: number, sort: string) {
const query = {
distinct: true,