Skip to content

Commit

Permalink
Merge pull request civitai#855 from civitai/s3-util-nits
Browse files Browse the repository at this point in the history
[CU-8686dzcy4] s3-utils: Stop asking the delivery worker for the current bucket
  • Loading branch information
koenbeuk authored Nov 20, 2023
2 parents 2507e03 + d96a48f commit 015a6ce
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 13 deletions.
10 changes: 0 additions & 10 deletions src/utils/delivery-worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,3 @@ export async function getDownloadUrl(fileUrl: string, fileName?: string) {
const result = await response.json();
return result as DownloadInfo;
}

export async function getDeliveryWorkerStatus() {
const url = new URL(deliveryWorkerEndpoint);
url.pathname = 'status';

const response = await fetch(url.toString());
const result = (await response.json()) as DeliveryWorkerStatus;

return result;
}
4 changes: 1 addition & 3 deletions src/utils/s3-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
} from '@aws-sdk/client-s3';
import { getSignedUrl } from '@aws-sdk/s3-request-presigner';
import { env } from '~/env/server.mjs';
import { getDeliveryWorkerStatus } from './delivery-worker';

const missingEnvs = (): string[] => {
const keys = [];
Expand Down Expand Up @@ -66,8 +65,7 @@ export function getS3Client() {
}

export async function getBucket() {
const deliveryWorkerStatus = await getDeliveryWorkerStatus();
return deliveryWorkerStatus.current?.name ?? env.S3_UPLOAD_BUCKET;
return env.S3_UPLOAD_BUCKET;
}

export async function getPutUrl(key: string, s3: S3Client | null = null) {
Expand Down

0 comments on commit 015a6ce

Please sign in to comment.