Skip to content

Commit

Permalink
add fileTable rules
Browse files Browse the repository at this point in the history
  • Loading branch information
prostgles committed Oct 27, 2023
1 parent 6db27a4 commit a481c37
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 49 deletions.
8 changes: 0 additions & 8 deletions lib/DboBuilder/insertDataParse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,6 @@ export async function insertDataParse(
const extraKeys = getExtraKeys(row);
const colInserts = getColumnInserts(row);

/* Upload file then continue insert */
// if (this.is_media) {
// return uploadFile.bind(this)(row, validate, localParams)

// } else
/* Potentially a nested join */
if (hasNestedInserts) {

Expand Down Expand Up @@ -278,9 +273,6 @@ export async function insertDataParse(
}));

const result = isMultiInsert ? _data : _data[0];
// if(validate && !isNestedInsert){
// result = isMultiInsert? await Promise.all(_data.map(async d => await validate({ ...d }))) : await validate({ ..._data[0] });
// }
const res = hasNestedInserts ?
{ insertResult: result } :
{ data: result };
Expand Down
8 changes: 6 additions & 2 deletions lib/PubSubManager/initPubSubManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,22 +92,26 @@ export async function initPubSubManager(this: PubSubManager): Promise<PubSubMana
END $$;`

const queryTimeoutMillis = Math.min(5e3, Math.round(this.appCheckFrequencyMS/2));
this.db.any(`
const timeout = setTimeout(() => {
this.db.any(`
/*
${queryIdentifier}
${REALTIME_TRIGGER_CHECK_QUERY}
${PubSubManager.EXCLUDE_QUERY_FROM_SCHEMA_WATCH_ID}
*/
DO $$
BEGIN
PERFORM pg_sleep(\${queryTimeoutMillis}/1e3);
/* PERFORM pg_sleep(\${queryTimeoutMillis}/1e3); */
PERFORM pg_cancel_backend(pid)
FROM pg_catalog.pg_stat_activity
WHERE pid <> pg_backend_pid()
AND query = \${queryIdentifier};
END $$;
`, { queryTimeoutMillis, queryIdentifier })
}, queryTimeoutMillis);
await this.db.any(checkForStaleTriggers);
clearTimeout(timeout);

tries = 5;
log("updated last_check");
} catch (e: any) {
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prostgles-server",
"version": "4.1.98",
"version": "4.1.99",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion tests/client/PID.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
30132
1097907
34 changes: 0 additions & 34 deletions tests/server/DBoGenerated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,16 +63,6 @@ export type DBSchemaGenerated = {
id?: number;
};
};
dmesg_logs: {
is_view: false;
select: true;
insert: true;
update: true;
delete: true;
columns: {
log?: null | string;
};
};
ex_j_ins: {
is_view: false;
select: true;
Expand All @@ -86,30 +76,6 @@ export type DBSchemaGenerated = {
public?: null | string;
};
};
files: {
is_view: false;
select: true;
insert: true;
update: true;
delete: true;
columns: {
added?: string;
cloud_url?: null | string;
content_length?: number;
content_type: string;
deleted?: null | number;
deleted_from_storage?: null | number;
description?: null | string;
etag?: null | string;
extension: string;
id?: string;
name: string;
original_name: string;
signed_url?: null | string;
signed_url_expires?: null | number;
url: string;
};
};
geography_columns: {
is_view: true;
select: true;
Expand Down
2 changes: 1 addition & 1 deletion tests/server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a481c37

Please sign in to comment.