Skip to content

Commit

Permalink
fix(): rebase plugins branch
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoGioioso committed May 7, 2023
1 parent 8b669e0 commit 249f3ed
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ ServerlessClient.prototype._getProcessesCount = async function () {
if (isCacheExpiredOrDisabled(this)) {
try {
const result = await this._plugin.processCount(this);

this._processCount.cache = {
count: result.rows[0].count || 0,
updated: Date.now()
Expand Down
18 changes: 9 additions & 9 deletions src/postgres.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class Postgres {

async getIdleProcessesListOrderByDate(serverlessPgSelf) {
const query = `
SELECT pid, backend_start, state
FROM pg_stat_activity
WHERE datname = $1
AND state = 'idle'
AND usename = $2
AND application_name = $4
ORDER BY state_change
LIMIT $3;`;
SELECT pid, backend_start, state
FROM pg_stat_activity
WHERE datname = $1
AND state = 'idle'
AND usename = $2
AND application_name = $4
ORDER BY state_change
LIMIT $3;`

const values = [
serverlessPgSelf._client.database,
Expand All @@ -48,7 +48,7 @@ class Postgres {
return serverlessPgSelf._client.query(query, values);
}

async processCount(serverlessPgSelf) {
async processCount(serverlessPgSelf){
const query = `
SELECT COUNT(pid)
FROM pg_stat_activity
Expand Down

0 comments on commit 249f3ed

Please sign in to comment.