mirror of https://github.com/buster-so/buster.git
use idempotencyKey key
This commit is contained in:
parent
d443c1c333
commit
08bb8c04f3
|
@ -65,7 +65,7 @@ const app = new Hono().get(
|
|||
organizationId: (await getUserOrganizationId(user.id))?.organizationId || '',
|
||||
accessToken: c.get('accessToken'),
|
||||
} satisfies TakeChatScreenshotTrigger,
|
||||
{ tags: [tag] }
|
||||
{ tags: [tag], idempotencyKey: tag }
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,8 +51,7 @@ const app = new Hono().get(
|
|||
versionNumber: version_number,
|
||||
password,
|
||||
},
|
||||
user,
|
||||
c
|
||||
user
|
||||
);
|
||||
|
||||
const tag = `take-dashboard-screenshot-${id}`;
|
||||
|
@ -63,7 +62,6 @@ const app = new Hono().get(
|
|||
context: c,
|
||||
})
|
||||
) {
|
||||
console.log('Taking dashboard screenshot');
|
||||
tasks.trigger(
|
||||
screenshots_task_keys.take_dashboard_screenshot,
|
||||
{
|
||||
|
@ -72,7 +70,7 @@ const app = new Hono().get(
|
|||
accessToken: c.get('accessToken'),
|
||||
isOnSaveEvent: false,
|
||||
} satisfies TakeDashboardScreenshotTrigger,
|
||||
{ tags: [tag] }
|
||||
{ tags: [tag], idempotencyKey: tag }
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -88,8 +86,7 @@ export default app;
|
|||
*/
|
||||
export async function getDashboardHandler(
|
||||
params: GetDashboardHandlerParams,
|
||||
user: User,
|
||||
c: Context
|
||||
user: User
|
||||
): Promise<GetDashboardResponse> {
|
||||
const { dashboardId, versionNumber, password } = params;
|
||||
|
||||
|
@ -269,26 +266,6 @@ export async function getDashboardHandler(
|
|||
workspace_member_count: workspaceMemberCount,
|
||||
};
|
||||
|
||||
const tag = `take-dashboard-screenshot-${dashboardId}`;
|
||||
if (
|
||||
await shouldTakeScreenshot({
|
||||
tag,
|
||||
key: screenshots_task_keys.take_dashboard_screenshot,
|
||||
context: c,
|
||||
})
|
||||
) {
|
||||
tasks.trigger(
|
||||
screenshots_task_keys.take_dashboard_screenshot,
|
||||
{
|
||||
dashboardId,
|
||||
isOnSaveEvent: false,
|
||||
organizationId: dashboardFile.organizationId,
|
||||
accessToken: c.get('accessToken'),
|
||||
} satisfies TakeDashboardScreenshotTrigger,
|
||||
{ tags: [tag] }
|
||||
);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ const app = new Hono()
|
|||
accessToken: c.get('accessToken'),
|
||||
organizationId,
|
||||
} satisfies TakeMetricScreenshotTrigger,
|
||||
{ tags: [tag] }
|
||||
{ tags: [tag], idempotencyKey: tag }
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ const app = new Hono()
|
|||
organizationId: (await getUserOrganizationId(user.id))?.organizationId || '',
|
||||
accessToken: c.get('accessToken'),
|
||||
} satisfies TakeReportScreenshotTrigger,
|
||||
{ tags: [tag] }
|
||||
{ tags: [tag], idempotencyKey: tag }
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { type TakeChatScreenshotTrigger, TakeChatScreenshotTriggerSchema } from
|
|||
import { screenshots_task_keys } from './task-keys';
|
||||
import { uploadScreenshotHandler } from './upload-screenshot-handler';
|
||||
|
||||
export const takeChartScreenshotHandlerTask: ReturnType<
|
||||
export const takeChatScreenshotHandlerTask: ReturnType<
|
||||
typeof schemaTask<
|
||||
typeof screenshots_task_keys.take_chat_screenshot,
|
||||
typeof TakeChatScreenshotTriggerSchema,
|
||||
|
|
Loading…
Reference in New Issue