Skip to content

Commit

Permalink
chore: set max connections to readonly jobsdbs (#2745)
Browse files Browse the repository at this point in the history
  • Loading branch information
chandumlg authored Nov 29, 2022
1 parent 4e8df6f commit 5e8f73d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jobsdb/readonly_jobsdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ func (jd *ReadonlyHandleT) Setup(tablePrefix string) error {
return fmt.Errorf("opening connection to db: %v", err)
}

jd.DbHandle.SetMaxOpenConns(config.GetInt("ReadonlyJobsDB."+jd.tablePrefix+"."+"maxOpenConnections", config.GetInt("ReadonlyJobsDB.maxOpenConnections", 5)))

ctx, cancel := context.WithTimeout(context.TODO(), config.GetDuration("JobsDB.dbPingTimeout", 10, time.Second))
defer cancel()

Expand Down Expand Up @@ -561,7 +563,7 @@ func (jd *ReadonlyHandleT) GetLatestFailedJobs(arg, prefix string) (string, erro
job_latest_state.exec_time,
job_latest_state.error_code, job_latest_state.error_response
FROM %[1]s
JOIN "v_last_%[2]s" job_latest_state ON %[1]s.job_id=job_latest_state.job_id
JOIN "v_last_%[2]s" job_latest_state ON %[1]s.job_id=job_latest_state.job_id
WHERE job_latest_state.job_state = 'failed'
`, dsList.JobTableName, dsList.JobStatusTableName)
if argList[1] != "" {
Expand Down

0 comments on commit 5e8f73d

Please sign in to comment.