mirror of
https://github.com/outline/outline.git
synced 2026-11-29 00:29:36 +03:00
perf: Lock only the target row in locked queries with joins (#14564)
This commit is contained in:
1 parent
8b253e058a
commit
631114129e
9 files changed
+14
-30
No files matched your search
@@ -131,7 +131,7 @@ export class GitHubIssueProvider extends BaseIssueProvider {
|
||||
required: true,
|
||||
},
|
||||
transaction,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: transaction.LOCK.NO_KEY_UPDATE, of: Integration },
|
||||
});
|
||||
const authentication = integration.authentication;
|
||||
|
||||
|
||||
@@ -121,7 +121,7 @@ router.post(
|
||||
|
||||
const webhookSubscription = await WebhookSubscription.findByPk(id, {
|
||||
rejectOnEmpty: true,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: transaction.LOCK.NO_KEY_UPDATE, of: WebhookSubscription },
|
||||
transaction,
|
||||
});
|
||||
|
||||
@@ -152,7 +152,7 @@ router.post(
|
||||
|
||||
const webhookSubscription = await WebhookSubscription.findByPk(id, {
|
||||
rejectOnEmpty: true,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: transaction.LOCK.NO_KEY_UPDATE, of: WebhookSubscription },
|
||||
transaction,
|
||||
});
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ export default abstract class ImportsProcessor<
|
||||
rejectOnEmpty: true,
|
||||
paranoid: false,
|
||||
transaction,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: transaction.LOCK.NO_KEY_UPDATE, of: Import },
|
||||
});
|
||||
|
||||
if (
|
||||
|
||||
@@ -150,7 +150,7 @@ export default abstract class APIImportTask<
|
||||
},
|
||||
],
|
||||
transaction,
|
||||
lock: Transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: Transaction.LOCK.NO_KEY_UPDATE, of: ImportTask },
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
@@ -32,7 +32,10 @@ export default class CleanupDemotedUserTask extends BaseTask<Props> {
|
||||
enabled: true,
|
||||
},
|
||||
transaction,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: {
|
||||
level: transaction.LOCK.NO_KEY_UPDATE,
|
||||
of: WebhookSubscription,
|
||||
},
|
||||
});
|
||||
await Promise.all(
|
||||
subscriptions.map((subscription) =>
|
||||
|
||||
@@ -209,7 +209,7 @@ router.post(
|
||||
const importModel = await Import.findByPk(id, {
|
||||
rejectOnEmpty: true,
|
||||
transaction,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: transaction.LOCK.NO_KEY_UPDATE, of: Import },
|
||||
});
|
||||
authorize(user, "delete", importModel);
|
||||
|
||||
@@ -234,7 +234,7 @@ router.post(
|
||||
let importModel = await Import.findByPk(id, {
|
||||
rejectOnEmpty: true,
|
||||
transaction,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: transaction.LOCK.NO_KEY_UPDATE, of: Import },
|
||||
});
|
||||
authorize(user, "cancel", importModel);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ const unsubscribe = async (ctx: APIContext<T.NotificationsUnsubscribeReq>) => {
|
||||
|
||||
const user = await User.scope("withTeam").findByPk(userId, {
|
||||
rejectOnEmpty: true,
|
||||
lock: transaction.LOCK.NO_KEY_UPDATE,
|
||||
lock: { level: transaction.LOCK.NO_KEY_UPDATE, of: User },
|
||||
transaction,
|
||||
});
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ export default async function main() {
|
||||
});
|
||||
|
||||
const webhooks = await WebhookSubscription.findAll({
|
||||
lock: Transaction.LOCK.UPDATE,
|
||||
lock: { level: Transaction.LOCK.UPDATE, of: WebhookSubscription },
|
||||
transaction,
|
||||
});
|
||||
|
||||
|
||||
@@ -6044,7 +6044,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@tanstack/react-virtual@npm:^3.14.26":
|
||||
"@tanstack/react-virtual@npm:^3.14.26, @tanstack/react-virtual@npm:^3.14.9":
|
||||
version: 3.14.26
|
||||
resolution: "@tanstack/react-virtual@npm:3.14.26"
|
||||
dependencies:
|
||||
@@ -6056,18 +6056,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@tanstack/react-virtual@npm:^3.14.9":
|
||||
version: 3.14.23
|
||||
resolution: "@tanstack/react-virtual@npm:3.14.23"
|
||||
dependencies:
|
||||
"@tanstack/virtual-core": "npm:3.19.8"
|
||||
peerDependencies:
|
||||
react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
|
||||
checksum: 10c0/cd39e337ba5d450be5cade885dd0a043ef9149abd95331c533b588a626573af4a48b0d4e78d2bcf36b4ffa1267921dfae7203dec8aa8aa7f128014accd2e4ff5
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@tanstack/table-core@npm:8.21.3":
|
||||
version: 8.21.3
|
||||
resolution: "@tanstack/table-core@npm:8.21.3"
|
||||
@@ -6082,13 +6070,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@tanstack/virtual-core@npm:3.19.8":
|
||||
version: 3.19.8
|
||||
resolution: "@tanstack/virtual-core@npm:3.19.8"
|
||||
checksum: 10c0/eac7a1edd843d8c0f1b07343a7804ac393fb152cb046581331c1c912b7dc518f484c5bca69cae2637739f447cffc86f779b3f4ca7b227872ed7cd5dc8fe5d28b
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@tokenizer/inflate@npm:^0.4.1":
|
||||
version: 0.4.1
|
||||
resolution: "@tokenizer/inflate@npm:0.4.1"
|
||||
|
||||
Reference in new issue
Block a user