Skip to content

Commit

Permalink
Add missing await
Browse files Browse the repository at this point in the history
  • Loading branch information
npalm committed Dec 7, 2021
1 parent ba504f8 commit 21bd350
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ describe('Test scale up lambda wrapper.', () => {
resolve();
});
});
await expect(handler({}, {}, {})).resolves;
await expect(handler({}, {})).resolves;
});

it('Scale without error should resolve2 . ', async () => {
const mock = mocked(sync);
mock.mockRejectedValue(new Error(''));

await expect(handler({}, {}, {})).resolves;
await expect(handler({}, {})).resolves;
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { sync } from './syncer/syncer';
import { logger } from './syncer/logger';

// eslint-disable-next-line
export async function handler(event: any, context: any, callback: any): Promise<void> {
export async function handler(event: any, context: any): Promise<void> {
logger.setSettings({ requestId: context.awsRequestId });
logger.debug(JSON.stringify(event));

try {
await sync();
callback(null);
} catch (e) {
logger.warn('Ignoring error:', e);
callback(e);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export async function sync(): Promise<void> {
const currentVersion = await getCachedVersion(s3, cacheObject);
logger.debug('latest: ' + currentVersion);
if (currentVersion === undefined || currentVersion != actionRunnerReleaseAsset.name) {
uploadToS3(s3, cacheObject, actionRunnerReleaseAsset);
await uploadToS3(s3, cacheObject, actionRunnerReleaseAsset);
} else {
logger.debug('Distribution is up-to-date, no action.');
}
Expand Down

0 comments on commit 21bd350

Please sign in to comment.