fix: 🐛 more strange unlock calls
This commit is contained in:
parent
805230341e
commit
68dea6f0c3
5 changed files with 9 additions and 17 deletions
|
@ -32,8 +32,6 @@ export default async function (
|
|||
// Interrupt if you block the announcement destination
|
||||
if (await shouldBlockInstance(extractDbHost(uri))) return;
|
||||
|
||||
const unlock = await getApLock(uri);
|
||||
|
||||
try {
|
||||
// Check if something with the same URI is already registered
|
||||
const exist = await fetchNote(uri);
|
||||
|
@ -60,9 +58,10 @@ export default async function (
|
|||
throw e;
|
||||
}
|
||||
|
||||
if (!(await Notes.isVisibleForMe(renote, actor.id)))
|
||||
return "skip: invalid actor for this activity";
|
||||
|
||||
if (renote != null && !(await Notes.isVisibleForMe(renote, actor.id))) {
|
||||
console.log("skip: invalid actor for this activity");
|
||||
return;
|
||||
}
|
||||
logger.info(`Creating the (Re)Note: ${uri}`);
|
||||
|
||||
const activityAudience = await parseAudience(
|
||||
|
@ -79,6 +78,6 @@ export default async function (
|
|||
uri,
|
||||
});
|
||||
} finally {
|
||||
unlock();
|
||||
await getApLock(uri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,8 +31,6 @@ export default async function (
|
|||
}
|
||||
}
|
||||
|
||||
const unlock = await getApLock(uri);
|
||||
|
||||
try {
|
||||
const exist = await fetchNote(note);
|
||||
if (exist) return "skip: note exists";
|
||||
|
@ -46,6 +44,6 @@ export default async function (
|
|||
throw e;
|
||||
}
|
||||
} finally {
|
||||
unlock();
|
||||
await getApLock(uri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@ export default async function (
|
|||
): Promise<string> {
|
||||
logger.info(`Deleting the Note: ${uri}`);
|
||||
|
||||
const unlock = await getApLock(uri);
|
||||
|
||||
try {
|
||||
const dbResolver = new DbResolver();
|
||||
const note = await dbResolver.getNoteFromApId(uri);
|
||||
|
@ -39,6 +37,6 @@ export default async function (
|
|||
await deleteNode(actor, note);
|
||||
return "ok: note deleted";
|
||||
} finally {
|
||||
unlock();
|
||||
await getApLock(uri);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -415,8 +415,6 @@ export async function resolveNote(
|
|||
`host ${extractDbHost(uri)} is blocked`,
|
||||
);
|
||||
|
||||
const unlock = await getApLock(uri);
|
||||
|
||||
try {
|
||||
//#region Returns if already registered with this server
|
||||
const exist = await fetchNote(uri);
|
||||
|
@ -439,7 +437,7 @@ export async function resolveNote(
|
|||
// Since the attached Note Object may be disguised, always specify the uri and fetch it from the server.
|
||||
return await createNote(uri, resolver, true);
|
||||
} finally {
|
||||
unlock();
|
||||
await getApLock(uri);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -430,7 +430,6 @@ export default abstract class Chart<T extends Schema> {
|
|||
? `${this.name}:${date}:${span}:${group}`
|
||||
: `${this.name}:${date}:${span}`;
|
||||
|
||||
const unlock = await getChartInsertLock(lockKey);
|
||||
try {
|
||||
// ロック内でもう1回チェックする
|
||||
const currentLog = (await repository.findOneBy({
|
||||
|
@ -466,7 +465,7 @@ export default abstract class Chart<T extends Schema> {
|
|||
|
||||
return log;
|
||||
} finally {
|
||||
unlock();
|
||||
await getChartInsertLock(lockKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue