Compare commits
1 Commits
847ef923bf
...
18b6ca3249
Author | SHA1 | Date | |
---|---|---|---|
|
18b6ca3249 |
@ -19,7 +19,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- add default
|
- add default
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- use dedicated connection for scheduler process
|
|
||||||
- *(deps)* update module gitlab.com/greyxor/slogor to v1.6.1
|
- *(deps)* update module gitlab.com/greyxor/slogor to v1.6.1
|
||||||
- orbis demo
|
- orbis demo
|
||||||
|
|
||||||
|
@ -67,13 +67,8 @@ func (s *Scheduler) acquireLeader(ctx context.Context) (bool, error) {
|
|||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return false, nil
|
return false, nil
|
||||||
default:
|
default:
|
||||||
db, err := s.db.Acquire(ctx)
|
|
||||||
if err != nil {
|
|
||||||
return false, fmt.Errorf("failed to acquire db connection: %w", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
var acquiredLock bool
|
var acquiredLock bool
|
||||||
if err := db.QueryRow(ctx, "SELECT pg_try_advisory_lock(1234)").Scan(&acquiredLock); err != nil {
|
if err := s.db.QueryRow(ctx, "SELECT pg_try_advisory_lock(1234)").Scan(&acquiredLock); err != nil {
|
||||||
if errors.Is(err, pgx.ErrNoRows) {
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user