Skip to content

Commit

Permalink
test: try to disable next cache on tb request
Browse files Browse the repository at this point in the history
  • Loading branch information
matyson committed May 20, 2024
1 parent b1a9751 commit 15ec77b
Showing 1 changed file with 27 additions and 35 deletions.
62 changes: 27 additions & 35 deletions apps/deepsirius-ui/src/server/api/routers/tb_consumer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,42 +21,34 @@ export const tbConsumerRouter = createTRPCRouter({
.query(async ({ input }) => {
const url = `${env.TENSORBOARD_API_URL}/api/tensorboard/start`;

try {
const res = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-KEY': env.TENSORBOARD_API_KEY,
},
body: JSON.stringify(input),
});
const headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('x-api-key', env.TENSORBOARD_API_KEY);
const options = {
method: 'POST',
headers,
body: JSON.stringify(input),
};

const res = await fetch(url, { ...options, cache: 'no-store' });

const data: unknown = await res.json();

const data: unknown = await res.json();

if (!res.ok) {
const error = z
.object({
status: z.string(),
message: z.string(),
})
.parse(data);

throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
message: error.message,
});
}
const parsed = TensorboardResponseSchema.parse(data);

return parsed;
} catch (e) {
console.log(e);
if (!res.ok) {
const error = z
.object({
status: z.string(),
message: z.string(),
})
.parse(data);

throw new TRPCError({
code: 'INTERNAL_SERVER_ERROR',
message: error.message,
});
}
return {
logdir: '',
name: '',
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
pid: 0,
};
const parsed = TensorboardResponseSchema.parse(data);

return parsed;
}),
});

0 comments on commit 15ec77b

Please sign in to comment.