Skip to content

Commit

Permalink
core/service/pg: suppress log when no mercury jobs present (#13894)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 authored Jul 18, 2024
1 parent 901609e commit 6f43b52
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/services/pg/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ package pg

import (
"database/sql"
"errors"
"fmt"
"log"
"os"
"time"

"github.com/XSAM/otelsql"
"github.com/google/uuid"
"github.com/jackc/pgconn"
"github.com/jackc/pgx/v4"
"github.com/jackc/pgx/v4/stdlib"
"github.com/jmoiron/sqlx"
Expand Down Expand Up @@ -130,6 +132,14 @@ func setMaxConns(db *sqlx.DB, config ConnectionConfig) {
// See: https://smartcontract-it.atlassian.net/browse/MERC-3654
var cnt int
if err := db.Get(&cnt, `SELECT COUNT(*) FROM ocr2_oracle_specs WHERE plugin_type = 'mercury'`); err != nil {
const errUndefinedTable = "42P01"
var pqerr *pgconn.PgError
if errors.As(err, &pqerr) {
if pqerr.Code == errUndefinedTable {
// no mercury jobs defined
return
}
}
log.Printf("Error checking mercury jobs: %s", err.Error())
return
}
Expand Down

0 comments on commit 6f43b52

Please sign in to comment.