chore (backend): rename the job

This commit is contained in:
naskya 2024-05-20 20:01:25 +09:00
parent cd901cd703
commit cf0c7b4687
No known key found for this signature in database
GPG key ID: 712D413B3A9FED5C
5 changed files with 13 additions and 13 deletions

View file

@ -24,7 +24,7 @@ import {
endedPollNotificationQueue,
webhookDeliverQueue,
} from "./queues.js";
import type { DbUserScheduledCreateNoteData, ThinUser } from "./types.js";
import type { DbUserScheduledNoteData, ThinUser } from "./types.js";
import type { Note } from "@/models/entities/note.js";
function renderError(e: Error): any {
@ -455,8 +455,8 @@ export function createDeleteAccountJob(
);
}
export function createScheduledCreateNoteJob(
options: DbUserScheduledCreateNoteData,
export function createScheduledNoteJob(
options: DbUserScheduledNoteData,
delay: number,
) {
return dbQueue.add("scheduledCreateNote", options, {

View file

@ -16,7 +16,7 @@ import { importMastoPost } from "./import-masto-post.js";
import { importCkPost } from "./import-firefish-post.js";
import { importBlocking } from "./import-blocking.js";
import { importCustomEmojis } from "./import-custom-emojis.js";
import { scheduledCreateNote } from "./scheduled-create-note.js";
import { scheduledNote } from "./scheduled-note.js";
const jobs = {
deleteDriveFiles,
@ -35,7 +35,7 @@ const jobs = {
importCkPost,
importCustomEmojis,
deleteAccount,
scheduledCreateNote,
scheduledNote,
} as Record<
string,
| Bull.ProcessCallbackFunction<DbJobData>

View file

@ -1,5 +1,5 @@
import { Users, Notes, ScheduledNotes } from "@/models/index.js";
import type { DbUserScheduledCreateNoteData } from "@/queue/types.js";
import type { DbUserScheduledNoteData } from "@/queue/types.js";
import { queueLogger } from "../../logger.js";
import type Bull from "bull";
import deleteNote from "@/services/note/delete.js";
@ -8,11 +8,11 @@ import { In } from "typeorm";
const logger = queueLogger.createSubLogger("scheduled-post");
export async function scheduledCreateNote(
job: Bull.Job<DbUserScheduledCreateNoteData>,
export async function scheduledNote(
job: Bull.Job<DbUserScheduledNoteData>,
done: () => void,
): Promise<void> {
logger.info("Scheduled creating note...");
logger.info(`Creating: ${job.data.noteId}`);
const user = await Users.findOneBy({ id: job.data.user.id });
if (user == null) {

View file

@ -26,7 +26,7 @@ export type DbJobData =
| DbUserImportJobData
| DbUserDeleteJobData
| DbUserImportMastoPostJobData
| DbUserScheduledCreateNoteData;
| DbUserScheduledNoteData;
export type DbUserJobData = {
user: ThinUser;
@ -57,7 +57,7 @@ export type DbUserImportMastoPostJobData = {
parent: Note | null;
};
export type DbUserScheduledCreateNoteData = {
export type DbUserScheduledNoteData = {
user: ThinUser;
option: {
visibility: string;

View file

@ -19,7 +19,7 @@ import define from "@/server/api/define.js";
import { HOUR, genId } from "backend-rs";
import { getNote } from "@/server/api/common/getters.js";
import { langmap } from "firefish-js";
import { createScheduledCreateNoteJob } from "@/queue/index.js";
import { createScheduledNoteJob } from "@/queue/index.js";
export const meta = {
tags: ["notes"],
@ -353,7 +353,7 @@ export default define(meta, paramDef, async (ps, user) => {
scheduledAt: new Date(ps.scheduledAt as number),
});
createScheduledCreateNoteJob(
createScheduledNoteJob(
{
user: { id: user.id },
noteId: note.id,