Skip to content

Commit

Permalink
more info in heratbeat
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsdev committed Aug 27, 2023
1 parent 0d16135 commit 12efa21
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
7 changes: 6 additions & 1 deletion dist/worker-wrapper.js

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

2 changes: 1 addition & 1 deletion dist/worker-wrapper.js.map

Large diffs are not rendered by default.

7 changes: 6 additions & 1 deletion dist/worker-wrapper.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,8 @@ var Worker = class {
output
});
const postgresClient = new pg.Pool({
connectionString
connectionString,
query_timeout: 5e3
});
postgresClient.on("error", (err) => {
parentPort.postMessage({
Expand All @@ -248,6 +249,10 @@ var Worker = class {
});
const heartbeat = async () => {
try {
parentPort.postMessage({
type: "ava-postgres",
message: "running postgres heartbeat..."
});
const { rows } = await postgresClient.query("SELECT 1");
parentPort.postMessage({
type: "ava-postgres",
Expand Down
2 changes: 1 addition & 1 deletion dist/worker-wrapper.mjs.map

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,7 @@ export class Worker {

const postgresClient = new pg.Pool({
connectionString,
query_timeout: 5000,
})

postgresClient.on("error", (err) => {
Expand All @@ -337,6 +338,11 @@ export class Worker {

const heartbeat = async () => {
try {
parentPort!.postMessage({
type: "ava-postgres",
message: "running postgres heartbeat...",
})

const { rows } = await postgresClient.query("SELECT 1")

parentPort!.postMessage({
Expand Down

0 comments on commit 12efa21

Please sign in to comment.