Compare commits
2 Commits
18b6ca3249
...
847ef923bf
Author | SHA1 | Date | |
---|---|---|---|
|
847ef923bf | ||
54aa310583 |
37
CHANGELOG.md
Normal file
37
CHANGELOG.md
Normal file
@ -0,0 +1,37 @@
|
||||
# Changelog
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.1.0] - 2025-01-17
|
||||
|
||||
### Added
|
||||
- enable worker process
|
||||
- add migration
|
||||
- add executor (#3)
|
||||
Adds an executor which can process and dispatch events to a set of workers.
|
||||
Co-authored-by: kjuulh <contact@kjuulh.io>
|
||||
Co-committed-by: kjuulh <contact@kjuulh.io>
|
||||
- add basic main.go
|
||||
- add default
|
||||
|
||||
### Fixed
|
||||
- use dedicated connection for scheduler process
|
||||
- *(deps)* update module gitlab.com/greyxor/slogor to v1.6.1
|
||||
- orbis demo
|
||||
|
||||
### Other
|
||||
- add more specific log for when leader is acquired
|
||||
- add basic leader election on top of postgres
|
||||
|
||||
- add orbis demo
|
||||
|
||||
- add basic scheduler
|
||||
|
||||
- add utility scripts
|
||||
- add utility scripts
|
||||
- add logger
|
||||
- add cmd
|
@ -67,8 +67,13 @@ func (s *Scheduler) acquireLeader(ctx context.Context) (bool, error) {
|
||||
case <-ctx.Done():
|
||||
return false, nil
|
||||
default:
|
||||
db, err := s.db.Acquire(ctx)
|
||||
if err != nil {
|
||||
return false, fmt.Errorf("failed to acquire db connection: %w", err)
|
||||
}
|
||||
|
||||
var acquiredLock bool
|
||||
if err := s.db.QueryRow(ctx, "SELECT pg_try_advisory_lock(1234)").Scan(&acquiredLock); err != nil {
|
||||
if err := db.QueryRow(ctx, "SELECT pg_try_advisory_lock(1234)").Scan(&acquiredLock); err != nil {
|
||||
if errors.Is(err, pgx.ErrNoRows) {
|
||||
return false, nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user