mirror of
https://github.com/sim1222/misskey.git
synced 2025-07-15 15:30:10 +09:00
fix lint
This commit is contained in:
@ -18,7 +18,7 @@ function renderError(e: Error): any {
|
||||
return {
|
||||
stack: e?.stack,
|
||||
message: e?.message,
|
||||
name: e?.name
|
||||
name: e?.name,
|
||||
};
|
||||
}
|
||||
|
||||
@ -74,157 +74,157 @@ export function deliver(user: ThinUser, content: unknown, to: string | null) {
|
||||
|
||||
const data = {
|
||||
user: {
|
||||
id: user.id
|
||||
id: user.id,
|
||||
},
|
||||
content,
|
||||
to
|
||||
to,
|
||||
};
|
||||
|
||||
return deliverQueue.add(data, {
|
||||
attempts: config.deliverJobMaxAttempts || 12,
|
||||
timeout: 1 * 60 * 1000, // 1min
|
||||
backoff: {
|
||||
type: 'apBackoff'
|
||||
type: 'apBackoff',
|
||||
},
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function inbox(activity: IActivity, signature: httpSignature.IParsedSignature) {
|
||||
const data = {
|
||||
activity: activity,
|
||||
signature
|
||||
signature,
|
||||
};
|
||||
|
||||
return inboxQueue.add(data, {
|
||||
attempts: config.inboxJobMaxAttempts || 8,
|
||||
timeout: 5 * 60 * 1000, // 5min
|
||||
backoff: {
|
||||
type: 'apBackoff'
|
||||
type: 'apBackoff',
|
||||
},
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createDeleteDriveFilesJob(user: ThinUser) {
|
||||
return dbQueue.add('deleteDriveFiles', {
|
||||
user: user
|
||||
user: user,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createExportNotesJob(user: ThinUser) {
|
||||
return dbQueue.add('exportNotes', {
|
||||
user: user
|
||||
user: user,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createExportFollowingJob(user: ThinUser) {
|
||||
return dbQueue.add('exportFollowing', {
|
||||
user: user
|
||||
user: user,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createExportMuteJob(user: ThinUser) {
|
||||
return dbQueue.add('exportMute', {
|
||||
user: user
|
||||
user: user,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createExportBlockingJob(user: ThinUser) {
|
||||
return dbQueue.add('exportBlocking', {
|
||||
user: user
|
||||
user: user,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createExportUserListsJob(user: ThinUser) {
|
||||
return dbQueue.add('exportUserLists', {
|
||||
user: user
|
||||
user: user,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createImportFollowingJob(user: ThinUser, fileId: DriveFile['id']) {
|
||||
return dbQueue.add('importFollowing', {
|
||||
user: user,
|
||||
fileId: fileId
|
||||
fileId: fileId,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createImportMutingJob(user: ThinUser, fileId: DriveFile['id']) {
|
||||
return dbQueue.add('importMuting', {
|
||||
user: user,
|
||||
fileId: fileId
|
||||
fileId: fileId,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createImportBlockingJob(user: ThinUser, fileId: DriveFile['id']) {
|
||||
return dbQueue.add('importBlocking', {
|
||||
user: user,
|
||||
fileId: fileId
|
||||
fileId: fileId,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createImportUserListsJob(user: ThinUser, fileId: DriveFile['id']) {
|
||||
return dbQueue.add('importUserLists', {
|
||||
user: user,
|
||||
fileId: fileId
|
||||
fileId: fileId,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createDeleteAccountJob(user: ThinUser, opts: { soft?: boolean; } = {}) {
|
||||
return dbQueue.add('deleteAccount', {
|
||||
user: user,
|
||||
soft: opts.soft
|
||||
soft: opts.soft,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createDeleteObjectStorageFileJob(key: string) {
|
||||
return objectStorageQueue.add('deleteFile', {
|
||||
key: key
|
||||
key: key,
|
||||
}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
export function createCleanRemoteFilesJob() {
|
||||
return objectStorageQueue.add('cleanRemoteFiles', {}, {
|
||||
removeOnComplete: true,
|
||||
removeOnFail: true
|
||||
removeOnFail: true,
|
||||
});
|
||||
}
|
||||
|
||||
@ -238,7 +238,7 @@ export default function() {
|
||||
|
||||
systemQueue.add('resyncCharts', {
|
||||
}, {
|
||||
repeat: { cron: '0 0 * * *' }
|
||||
repeat: { cron: '0 0 * * *' },
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -12,13 +12,13 @@ export function initialize<T>(name: string, limitPerSec = -1) {
|
||||
prefix: config.redis.prefix ? `${config.redis.prefix}:queue` : 'queue',
|
||||
limiter: limitPerSec > 0 ? {
|
||||
max: limitPerSec,
|
||||
duration: 1000
|
||||
duration: 1000,
|
||||
} : undefined,
|
||||
settings: {
|
||||
backoffStrategies: {
|
||||
apBackoff
|
||||
}
|
||||
}
|
||||
apBackoff,
|
||||
},
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -25,12 +25,12 @@ export async function deleteAccount(job: Bull.Job<DbUserDeleteJobData>): Promise
|
||||
const notes = await Notes.find({
|
||||
where: {
|
||||
userId: user.id,
|
||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
||||
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||
},
|
||||
take: 100,
|
||||
order: {
|
||||
id: 1
|
||||
}
|
||||
id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (notes.length === 0) {
|
||||
@ -52,12 +52,12 @@ export async function deleteAccount(job: Bull.Job<DbUserDeleteJobData>): Promise
|
||||
const files = await DriveFiles.find({
|
||||
where: {
|
||||
userId: user.id,
|
||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
||||
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||
},
|
||||
take: 10,
|
||||
order: {
|
||||
id: 1
|
||||
}
|
||||
id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (files.length === 0) {
|
||||
|
@ -24,12 +24,12 @@ export async function deleteDriveFiles(job: Bull.Job<DbUserJobData>, done: any):
|
||||
const files = await DriveFiles.find({
|
||||
where: {
|
||||
userId: user.id,
|
||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
||||
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||
},
|
||||
take: 100,
|
||||
order: {
|
||||
id: 1
|
||||
}
|
||||
id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (files.length === 0) {
|
||||
|
@ -40,12 +40,12 @@ export async function exportBlocking(job: Bull.Job<DbUserJobData>, done: any): P
|
||||
const blockings = await Blockings.find({
|
||||
where: {
|
||||
blockerId: user.id,
|
||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
||||
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||
},
|
||||
take: 100,
|
||||
order: {
|
||||
id: 1
|
||||
}
|
||||
id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (blockings.length === 0) {
|
||||
|
@ -40,12 +40,12 @@ export async function exportFollowing(job: Bull.Job<DbUserJobData>, done: any):
|
||||
const followings = await Followings.find({
|
||||
where: {
|
||||
followerId: user.id,
|
||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
||||
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||
},
|
||||
take: 100,
|
||||
order: {
|
||||
id: 1
|
||||
}
|
||||
id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (followings.length === 0) {
|
||||
|
@ -40,12 +40,12 @@ export async function exportMute(job: Bull.Job<DbUserJobData>, done: any): Promi
|
||||
const mutes = await Mutings.find({
|
||||
where: {
|
||||
muterId: user.id,
|
||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
||||
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||
},
|
||||
take: 100,
|
||||
order: {
|
||||
id: 1
|
||||
}
|
||||
id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (mutes.length === 0) {
|
||||
|
@ -22,7 +22,7 @@ export async function exportUserLists(job: Bull.Job<DbUserJobData>, done: any):
|
||||
}
|
||||
|
||||
const lists = await UserLists.find({
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
// Create temp file
|
||||
@ -40,7 +40,7 @@ export async function exportUserLists(job: Bull.Job<DbUserJobData>, done: any):
|
||||
for (const list of lists) {
|
||||
const joinings = await UserListJoinings.find({ userListId: list.id });
|
||||
const users = await Users.find({
|
||||
id: In(joinings.map(j => j.userId))
|
||||
id: In(joinings.map(j => j.userId)),
|
||||
});
|
||||
|
||||
for (const u of users) {
|
||||
|
@ -21,7 +21,7 @@ export async function importBlocking(job: Bull.Job<DbUserImportJobData>, done: a
|
||||
}
|
||||
|
||||
const file = await DriveFiles.findOne({
|
||||
id: job.data.fileId
|
||||
id: job.data.fileId,
|
||||
});
|
||||
if (file == null) {
|
||||
done();
|
||||
@ -41,10 +41,10 @@ export async function importBlocking(job: Bull.Job<DbUserImportJobData>, done: a
|
||||
|
||||
let target = isSelfHost(host!) ? await Users.findOne({
|
||||
host: null,
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
}) : await Users.findOne({
|
||||
host: toPuny(host!),
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
});
|
||||
|
||||
if (host == null && target == null) continue;
|
||||
|
@ -21,7 +21,7 @@ export async function importFollowing(job: Bull.Job<DbUserImportJobData>, done:
|
||||
}
|
||||
|
||||
const file = await DriveFiles.findOne({
|
||||
id: job.data.fileId
|
||||
id: job.data.fileId,
|
||||
});
|
||||
if (file == null) {
|
||||
done();
|
||||
@ -41,10 +41,10 @@ export async function importFollowing(job: Bull.Job<DbUserImportJobData>, done:
|
||||
|
||||
let target = isSelfHost(host!) ? await Users.findOne({
|
||||
host: null,
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
}) : await Users.findOne({
|
||||
host: toPuny(host!),
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
});
|
||||
|
||||
if (host == null && target == null) continue;
|
||||
|
@ -22,7 +22,7 @@ export async function importMuting(job: Bull.Job<DbUserImportJobData>, done: any
|
||||
}
|
||||
|
||||
const file = await DriveFiles.findOne({
|
||||
id: job.data.fileId
|
||||
id: job.data.fileId,
|
||||
});
|
||||
if (file == null) {
|
||||
done();
|
||||
@ -42,10 +42,10 @@ export async function importMuting(job: Bull.Job<DbUserImportJobData>, done: any
|
||||
|
||||
let target = isSelfHost(host!) ? await Users.findOne({
|
||||
host: null,
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
}) : await Users.findOne({
|
||||
host: toPuny(host!),
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
});
|
||||
|
||||
if (host == null && target == null) continue;
|
||||
|
@ -22,7 +22,7 @@ export async function importUserLists(job: Bull.Job<DbUserImportJobData>, done:
|
||||
}
|
||||
|
||||
const file = await DriveFiles.findOne({
|
||||
id: job.data.fileId
|
||||
id: job.data.fileId,
|
||||
});
|
||||
if (file == null) {
|
||||
done();
|
||||
@ -42,7 +42,7 @@ export async function importUserLists(job: Bull.Job<DbUserImportJobData>, done:
|
||||
|
||||
let list = await UserLists.findOne({
|
||||
userId: user.id,
|
||||
name: listName
|
||||
name: listName,
|
||||
});
|
||||
|
||||
if (list == null) {
|
||||
@ -51,16 +51,16 @@ export async function importUserLists(job: Bull.Job<DbUserImportJobData>, done:
|
||||
createdAt: new Date(),
|
||||
userId: user.id,
|
||||
name: listName,
|
||||
userIds: []
|
||||
userIds: [],
|
||||
});
|
||||
}
|
||||
|
||||
let target = isSelfHost(host!) ? await Users.findOne({
|
||||
host: null,
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
}) : await Users.findOne({
|
||||
host: toPuny(host!),
|
||||
usernameLower: username.toLowerCase()
|
||||
usernameLower: username.toLowerCase(),
|
||||
});
|
||||
|
||||
if (target == null) {
|
||||
|
@ -33,7 +33,7 @@ export default async (job: Bull.Job<DeliverJobData>) => {
|
||||
if (suspendedHosts == null) {
|
||||
suspendedHosts = await Instances.find({
|
||||
where: {
|
||||
isSuspended: true
|
||||
isSuspended: true,
|
||||
},
|
||||
});
|
||||
suspendedHostsCache.set(null, suspendedHosts);
|
||||
@ -55,7 +55,7 @@ export default async (job: Bull.Job<DeliverJobData>) => {
|
||||
latestRequestSentAt: new Date(),
|
||||
latestStatus: 200,
|
||||
lastCommunicatedAt: new Date(),
|
||||
isNotResponding: false
|
||||
isNotResponding: false,
|
||||
});
|
||||
|
||||
fetchInstanceMetadata(i);
|
||||
@ -70,7 +70,7 @@ export default async (job: Bull.Job<DeliverJobData>) => {
|
||||
Instances.update(i.id, {
|
||||
latestRequestSentAt: new Date(),
|
||||
latestStatus: res instanceof StatusError ? res.statusCode : null,
|
||||
isNotResponding: true
|
||||
isNotResponding: true,
|
||||
});
|
||||
|
||||
instanceChart.requestSent(i.host, false);
|
||||
|
@ -135,7 +135,7 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
||||
Instances.update(i.id, {
|
||||
latestRequestReceivedAt: new Date(),
|
||||
lastCommunicatedAt: new Date(),
|
||||
isNotResponding: false
|
||||
isNotResponding: false,
|
||||
});
|
||||
|
||||
fetchInstanceMetadata(i);
|
||||
|
@ -18,12 +18,12 @@ export default async function cleanRemoteFiles(job: Bull.Job<Record<string, unkn
|
||||
where: {
|
||||
userHost: Not(IsNull()),
|
||||
isLink: false,
|
||||
...(cursor ? { id: MoreThan(cursor) } : {})
|
||||
...(cursor ? { id: MoreThan(cursor) } : {}),
|
||||
},
|
||||
take: 8,
|
||||
order: {
|
||||
id: 1
|
||||
}
|
||||
id: 1,
|
||||
},
|
||||
});
|
||||
|
||||
if (files.length === 0) {
|
||||
|
Reference in New Issue
Block a user