Skip to content

Commit 046be1f

Browse files
committed
revert awaits
1 parent 143d502 commit 046be1f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1029,7 +1029,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
10291029
const qs = `CREATE TABLE IF NOT EXISTS $1:name (${patternsArray.join()})`;
10301030
const values = [className, ...valuesArray];
10311031

1032-
await conn.task('create-table', async t => {
1032+
return conn.task('create-table', async t => {
10331033
try {
10341034
await t.none(qs, values);
10351035
} catch (error) {
@@ -1952,7 +1952,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
19521952
const constraintName = `${className}_unique_${fieldNames.sort().join('_')}`;
19531953
const constraintPatterns = fieldNames.map((fieldName, index) => `$${index + 3}:name`);
19541954
const qs = `CREATE UNIQUE INDEX IF NOT EXISTS $2:name ON $1:name(${constraintPatterns.join()})`;
1955-
await this._client.none(qs, [className, constraintName, ...fieldNames]).catch(error => {
1955+
return this._client.none(qs, [className, constraintName, ...fieldNames]).catch(error => {
19561956
if (error.code === PostgresDuplicateRelationError && error.message.includes(constraintName)) {
19571957
// Index already exists. Ignore error.
19581958
} else if (
@@ -2302,7 +2302,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
23022302
.then(() => this.schemaUpgrade(schema.className, schema));
23032303
});
23042304
promises.push(this._listenToSchema());
2305-
await Promise.all(promises)
2305+
return Promise.all(promises)
23062306
.then(() => {
23072307
return this._client.tx('perform-initialization', async t => {
23082308
await t.none(sql.misc.jsonObjectSetKeys);
@@ -2447,7 +2447,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
24472447
): Promise<any> {
24482448
const conn = options.conn !== undefined ? options.conn : this._client;
24492449
const qs = 'DROP FUNCTION IF EXISTS idempodency_delete_old_rows()';
2450-
await conn
2450+
return conn
24512451
.none(qs)
24522452
.catch(error => {
24532453
throw error;
@@ -2460,7 +2460,7 @@ export class PostgresStorageAdapter implements StorageAdapter {
24602460
const conn = options.conn !== undefined ? options.conn : this._client;
24612461
const ttlOptions = options.ttl !== undefined ? `${options.ttl} seconds` : '60 seconds';
24622462
const qs = 'CREATE OR REPLACE FUNCTION idempodency_delete_old_rows() RETURNS void LANGUAGE plpgsql AS $$ BEGIN DELETE FROM "_Idempotency" WHERE expire < NOW() - INTERVAL $1; END; $$;';
2463-
await conn
2463+
return conn
24642464
.none(qs, [ttlOptions])
24652465
.catch(error => {
24662466
if (

0 commit comments

Comments
 (0)