iceshrimp-legacy/packages/backend/src/queue/queues.ts
Kaity A 706b4ae602 Add sonic full-text search support (#9714)
This pull request adds support for the [sonic](https://github.com/valeriansaliou/sonic) full text indexing server into Calckey.

In addition to this, a stateful endpoint has been added that will completely (re-)index all notes into any (elasticsearch and/or sonic) indexing server defined in your config at `/api/admin/search/index-all`. It can (optionally) take input data to define the starting point, such as:

```
{"cursor": "9beg3lx6ad"}
```

Currently if both sonic and elasticsearch are defined in the config, sonic will take precedence for searching, but both indexes will continue to be updated for new note creations. Future enhancements may include the ability to choose which indexer to use (or combine multiple).

Co-authored-by: Kaitlyn Allan <kaitlyn.allan@enlabs.cloud>
Reviewed-on: https://codeberg.org/calckey/calckey/pulls/9714
Co-authored-by: Kaity A <supakaity@noreply.codeberg.org>
Co-committed-by: Kaity A <supakaity@noreply.codeberg.org>
2023-03-19 08:26:47 +00:00

42 lines
1.1 KiB
TypeScript

import config from "@/config/index.js";
import { initialize as initializeQueue } from "./initialize.js";
import type {
DeliverJobData,
InboxJobData,
DbJobData,
ObjectStorageJobData,
EndedPollNotificationJobData,
WebhookDeliverJobData,
} from "./types.js";
export const systemQueue = initializeQueue<Record<string, unknown>>("system");
export const endedPollNotificationQueue =
initializeQueue<EndedPollNotificationJobData>("endedPollNotification");
export const deliverQueue = initializeQueue<DeliverJobData>(
"deliver",
config.deliverJobPerSec || 128,
);
export const inboxQueue = initializeQueue<InboxJobData>(
"inbox",
config.inboxJobPerSec || 16,
);
export const dbQueue = initializeQueue<DbJobData>("db");
export const objectStorageQueue =
initializeQueue<ObjectStorageJobData>("objectStorage");
export const webhookDeliverQueue = initializeQueue<WebhookDeliverJobData>(
"webhookDeliver",
64,
);
export const backgroundQueue = initializeQueue<Record<string, unknown>>("bg");
export const queues = [
systemQueue,
endedPollNotificationQueue,
deliverQueue,
inboxQueue,
dbQueue,
objectStorageQueue,
webhookDeliverQueue,
backgroundQueue,
];