Skip to content

Commit

Permalink
feature: add support for multi region param
Browse files Browse the repository at this point in the history
  • Loading branch information
ShayElkana committed May 21, 2024
1 parent 2eea75e commit 7484ca2
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/services/push-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export const getAppVersionDeploymentStatus = async (appVersionId: number, region
export const pollForDeploymentStatus = async (
appVersionId: number,
retryAfter: number,
region?: Region,
options: {
ttl?: number;
progressLogger?: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => void;
Expand All @@ -115,7 +116,7 @@ export const pollForDeploymentStatus = async (
DeploymentStatusTypesSchema['building-app'],
DeploymentStatusTypesSchema['deploying-app'],
];
const response = await getAppVersionDeploymentStatus(appVersionId);
const response = await getAppVersionDeploymentStatus(appVersionId, region);
if (statusesToKeepPolling.includes(response.status)) {
if (progressLogger) {
progressLogger(response.status, response.tip);
Expand All @@ -129,7 +130,7 @@ export const pollForDeploymentStatus = async (
retryAfter,
ttl || retryAfter * 60,
);
const response = await getAppVersionDeploymentStatus(appVersionId);
const response = await getAppVersionDeploymentStatus(appVersionId, region);
return response;
};

Expand Down Expand Up @@ -203,7 +204,7 @@ export const buildAssetToDeployTask = async (

export const prepareEnvironmentTask = async (ctx: PushCommandTasksContext) => {
try {
const signedCloudStorageUrl = await getSignedStorageUrl(ctx.appVersionId);
const signedCloudStorageUrl = await getSignedStorageUrl(ctx.appVersionId, ctx.region);
const archiveContent = readFileData(ctx.archivePath!);
ctx.signedCloudStorageUrl = signedCloudStorageUrl;
ctx.archiveContent = archiveContent;
Expand Down Expand Up @@ -289,7 +290,7 @@ export const handleDeploymentTask = async (
const now = Date.now();
const retryAfter = TimeInMs.second * 5;
const ttl = TimeInMs.minute * 30;
const deploymentStatus = await pollForDeploymentStatus(ctx.appVersionId, retryAfter, {
const deploymentStatus = await pollForDeploymentStatus(ctx.appVersionId, retryAfter, ctx.region, {
ttl,
progressLogger: (message: keyof typeof DeploymentStatusTypesSchema, tip?: string) => {
const deltaInSeconds = (Date.now() - now) / TimeInMs.second;
Expand Down

0 comments on commit 7484ca2

Please sign in to comment.