Skip to content

Commit

Permalink
fix(self-hosted): enable air-gapped use by disabling online check of …
Browse files Browse the repository at this point in the history
…react query (langfuse#2374)
  • Loading branch information
marcklingen authored Jun 19, 2024
1 parent 33155de commit b6a31f6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 25 deletions.
45 changes: 20 additions & 25 deletions packages/shared/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,11 +377,10 @@ async function uploadObjects(
});

for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Sessions ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Sessions ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -395,11 +394,10 @@ async function uploadObjects(
);
});
for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Traces ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Traces ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -413,11 +411,10 @@ async function uploadObjects(
});

for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Observations ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Observations ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -431,11 +428,10 @@ async function uploadObjects(
});

for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Events ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Events ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}

Expand All @@ -448,11 +444,10 @@ async function uploadObjects(
);
});
for (let i = 0; i < promises.length; i++) {
process.stdout.clearLine(0);
process.stdout.cursorTo(0);
process.stdout.write(
`Seeding of Scores ${(i / promises.length) * 100}% complete`
);
if (i + 1 >= promises.length || i % Math.ceil(promises.length / 10) === 0)
console.log(
`Seeding of Scores ${((i + 1) / promises.length) * 100}% complete`
);
await promises[i];
}
}
Expand Down
12 changes: 12 additions & 0 deletions web/src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,21 @@ export const api = createTRPCNext<AppRouter>({
defaultOptions: {
queries: {
onError: (error) => trpcErrorToast(error),
// react query defaults to `online`, but we want to disable it in dev and when self-hosting
networkMode:
process.env.NODE_ENV === "development" ||
process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === undefined
? "always"
: "online",
},
mutations: {
onError: (error) => trpcErrorToast(error),
// react query defaults to `online`, but we want to disable it in dev and when self-hosting
networkMode:
process.env.NODE_ENV === "development" ||
process.env.NEXT_PUBLIC_LANGFUSE_CLOUD_REGION === undefined
? "always"
: "online",
},
},
},
Expand Down

0 comments on commit b6a31f6

Please sign in to comment.