Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Commit

Permalink
chore: bullのダッシュボードを分離
Browse files Browse the repository at this point in the history
  • Loading branch information
yupix committed Sep 27, 2023
1 parent 59478ca commit ebfe4bf
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"build-gulp": "gulp build",
"export": "pnpm build-ts && node ./built/migration/migrateAyuskeyNext.js",
"worker": "node ./built/migration/worker.js",
"bull-board": "node ./built/migration/bullDashboard.js",
"next": "node ./built/migration/migrateAyuskeyNext.js",
"webpack": "webpack",
"dev": "echo \"**コミットをしたら再起動が必要!!/Need to restart after a commit!!**\" && run-p watch-webpack gulpstart",
Expand Down
21 changes: 3 additions & 18 deletions src/migration/migrateAyuskeyNext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import { AyuskeyNextEntities } from "@/v13/models";
import config from "@/config";

import { migrateMeta } from "./meta";
import { spawn } from "child_process";
import { migrateUsedUsernames } from "./UsedUsername";



import { migrateUsers } from "./user";
import { migrateRelaies } from "./Relay";
import { migrateApps } from "./App";
Expand All @@ -23,8 +20,7 @@ import { migrateUserListJoinings } from "./UserListJoining";
import { migrateAnnouncements } from "./Announcement";
import { migrateInstances } from "./instance";
import { migrateHashtags } from "./hashtag";


import { logger } from "./common";

async function main(): Promise<any> {
const originalDb = await initDb();
Expand All @@ -39,15 +35,6 @@ async function main(): Promise<any> {
entities: AyuskeyNextEntities,
});


const bullDashboardProc = spawn("node", [
"./built/migration/bullDashboard.js",
]);

bullDashboardProc.stdout.on("message", (data) => {
console.log(data);
});

await migrateAnnouncements();
await migrateRelaies(originalDb, nextDb);
await migrateUsedUsernames(originalDb, nextDb);
Expand All @@ -64,10 +51,8 @@ async function main(): Promise<any> {
await migrateSwSubscriptions();
await migrateUsers(originalDb, nextDb);

process.on("SIGINT", () => {
bullDashboardProc.kill();
process.exit(0);
});
logger.succ("ジョブの登録が完了しました")

}

main().catch((e) => {
Expand Down
3 changes: 2 additions & 1 deletion src/migration/userAfterHook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { getConnection } from "typeorm";
import { migratePasswordResetRequests } from "./PassworResetRequest";
import { migrateAuthSessions } from "./AuthSession";
import { userAfterHookQueue } from "./jobqueue";
import { logger } from "./common";

export async function userAfterHook(user: User) {
const originalDb = getConnection();
Expand All @@ -33,5 +34,5 @@ export async function userAfterHook(user: User) {
if (await userAfterHookQueue.getCompletedCount() > 1000) {
await userAfterHookQueue.clean(0, "completed");
}
console.info(`UserAfterHook: ${user.id} の処理が完了しました`);
logger.succ(`UserAfterHook: ${user.id} の処理が完了しました`);
}

0 comments on commit ebfe4bf

Please sign in to comment.