mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
feat(federation): ✨ Add config option to control automatic queue purge time
This commit is contained in:
parent
048dd6b0ab
commit
61b773ed11
|
|
@ -259,6 +259,21 @@ language = "en"
|
||||||
# A style name from https://www.dicebear.com/styles
|
# A style name from https://www.dicebear.com/styles
|
||||||
placeholder_style = "thumbs"
|
placeholder_style = "thumbs"
|
||||||
|
|
||||||
|
[queues]
|
||||||
|
# Control the delivery queue (for outbound federation)
|
||||||
|
[queues.delivery]
|
||||||
|
# Time in seconds to remove completed jobs
|
||||||
|
remove_on_complete = 31536000
|
||||||
|
# Time in seconds to remove failed jobs
|
||||||
|
remove_on_failure = 31536000
|
||||||
|
|
||||||
|
# Control the inbox processing queue (for inbound federation)
|
||||||
|
[queues.inbox]
|
||||||
|
# Time in seconds to remove completed jobs
|
||||||
|
remove_on_complete = 31536000
|
||||||
|
# Time in seconds to remove failed jobs
|
||||||
|
remove_on_failure = 31536000
|
||||||
|
|
||||||
[federation]
|
[federation]
|
||||||
# This is a list of domain names, such as "mastodon.social" or "pleroma.site"
|
# This is a list of domain names, such as "mastodon.social" or "pleroma.site"
|
||||||
# These changes will not retroactively apply to existing data before they were changed
|
# These changes will not retroactively apply to existing data before they were changed
|
||||||
|
|
|
||||||
|
|
@ -3298,6 +3298,58 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"queues": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"delivery": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"remove_on_complete": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 31536000
|
||||||
|
},
|
||||||
|
"remove_on_failure": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 31536000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"default": {
|
||||||
|
"remove_on_complete": 31536000,
|
||||||
|
"remove_on_failure": 31536000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"inbox": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"remove_on_complete": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 31536000
|
||||||
|
},
|
||||||
|
"remove_on_failure": {
|
||||||
|
"type": "integer",
|
||||||
|
"default": 31536000
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"default": {
|
||||||
|
"remove_on_complete": 31536000,
|
||||||
|
"remove_on_failure": 31536000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"default": {
|
||||||
|
"delivery": {
|
||||||
|
"remove_on_complete": 31536000,
|
||||||
|
"remove_on_failure": 31536000
|
||||||
|
},
|
||||||
|
"inbox": {
|
||||||
|
"remove_on_complete": 31536000,
|
||||||
|
"remove_on_failure": 31536000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"instance": {
|
"instance": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
|
||||||
|
|
@ -525,6 +525,53 @@ export const configValidator = z
|
||||||
token: "",
|
token: "",
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
queues: z
|
||||||
|
.object({
|
||||||
|
delivery: z
|
||||||
|
.object({
|
||||||
|
remove_on_complete: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
// 1 year
|
||||||
|
.default(60 * 60 * 24 * 365),
|
||||||
|
remove_on_failure: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
// 1 year
|
||||||
|
.default(60 * 60 * 24 * 365),
|
||||||
|
})
|
||||||
|
.default({
|
||||||
|
remove_on_complete: 60 * 60 * 24 * 365,
|
||||||
|
remove_on_failure: 60 * 60 * 24 * 365,
|
||||||
|
}),
|
||||||
|
inbox: z
|
||||||
|
.object({
|
||||||
|
remove_on_complete: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
// 1 year
|
||||||
|
.default(60 * 60 * 24 * 365),
|
||||||
|
remove_on_failure: z
|
||||||
|
.number()
|
||||||
|
.int()
|
||||||
|
// 1 year
|
||||||
|
.default(60 * 60 * 24 * 365),
|
||||||
|
})
|
||||||
|
.default({
|
||||||
|
remove_on_complete: 60 * 60 * 24 * 365,
|
||||||
|
remove_on_failure: 60 * 60 * 24 * 365,
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
.default({
|
||||||
|
delivery: {
|
||||||
|
remove_on_complete: 60 * 60 * 24 * 365,
|
||||||
|
remove_on_failure: 60 * 60 * 24 * 365,
|
||||||
|
},
|
||||||
|
inbox: {
|
||||||
|
remove_on_complete: 60 * 60 * 24 * 365,
|
||||||
|
remove_on_failure: 60 * 60 * 24 * 365,
|
||||||
|
},
|
||||||
|
}),
|
||||||
instance: z
|
instance: z
|
||||||
.object({
|
.object({
|
||||||
name: z.string().min(1).default("Versia"),
|
name: z.string().min(1).default("Versia"),
|
||||||
|
|
|
||||||
20
worker.ts
20
worker.ts
|
|
@ -104,7 +104,15 @@ export const deliveryWorker = new Worker<
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ connection },
|
{
|
||||||
|
connection,
|
||||||
|
removeOnComplete: {
|
||||||
|
age: config.queues.delivery.remove_on_complete,
|
||||||
|
},
|
||||||
|
removeOnFail: {
|
||||||
|
age: config.queues.delivery.remove_on_failure,
|
||||||
|
},
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
export const inboxWorker = new Worker<InboxJobData, Response, InboxJobType>(
|
export const inboxWorker = new Worker<InboxJobData, Response, InboxJobType>(
|
||||||
|
|
@ -242,5 +250,13 @@ export const inboxWorker = new Worker<InboxJobData, Response, InboxJobType>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{ connection, removeOnComplete: { count: 0 } },
|
{
|
||||||
|
connection,
|
||||||
|
removeOnComplete: {
|
||||||
|
age: config.queues.inbox.remove_on_complete,
|
||||||
|
},
|
||||||
|
removeOnFail: {
|
||||||
|
age: config.queues.inbox.remove_on_failure,
|
||||||
|
},
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue