Skip to content

Commit

Permalink
Add isDormant field for server model, skil fetching dormant
Browse files Browse the repository at this point in the history
  • Loading branch information
O4epegb committed Oct 27, 2024
1 parent 404e28c commit 515b5fd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions apps/api/prisma/migrations/20241027124904_/migration.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Server" ADD COLUMN "isDormant" BOOLEAN NOT NULL DEFAULT false;
1 change: 1 addition & 0 deletions apps/api/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ model Server {
baseUrl String
morgueUrl String?
logfile Logfile[]
isDormant Boolean @default(false)
}

model Logfile {
Expand Down
1 change: 1 addition & 0 deletions apps/api/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ async function main() {
url: server.url,
baseUrl: server.baseUrl,
morgueUrl: server.morgueUrl,
isDormant: 'isDormant' in server ? server.isDormant : false,
}
const s = await prisma.server.upsert({
create: data,
Expand Down
1 change: 1 addition & 0 deletions apps/api/prisma/seedData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ export const data = {
url: 'http://webzook.net:8080',
baseUrl: 'https://webzook.net',
morgueUrl: 'http://webzook.net/soup/morgue',
isDormant: true,
logfiles: [
...range(13, 32).map((version) => ({
path: `/soup/0.${version}/logfile`,
Expand Down
5 changes: 4 additions & 1 deletion apps/api/src/parser/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export const startFetchQueue = async () => {
})

const main = async () => {
const logfiles = await prisma.logfile.findMany({ include: { server: true } })
const logfiles = await prisma.logfile.findMany({
where: { server: { isDormant: false } },
include: { server: true },
})

for (const file of shuffle(logfiles)) {
queue.add(() =>
Expand Down

0 comments on commit 515b5fd

Please sign in to comment.