Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 27dd826

Browse filesBrowse files
committed
fix: show correct DLE start time in API instead of the current time (#309)
1 parent ec7631f commit 27dd826
Copy full SHA for 27dd826

File tree

2 files changed

+12
-29
lines changed
Filter options

2 files changed

+12
-29
lines changed

‎internal/cloning/base.go

Copy file name to clipboardExpand all lines: internal/cloning/base.go
+9-28Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
"sync"
1515
"time"
1616

17-
"github.com/AlekSi/pointer"
1817
"github.com/jackc/pgtype/pgxtype"
1918
"github.com/jackc/pgx/v4"
2019
_ "github.com/lib/pq" // Register Postgres database driver.
@@ -29,7 +28,6 @@ import (
2928
"gitlab.com/postgres-ai/database-lab/v3/pkg/models"
3029
"gitlab.com/postgres-ai/database-lab/v3/pkg/util"
3130
"gitlab.com/postgres-ai/database-lab/v3/pkg/util/pglog"
32-
"gitlab.com/postgres-ai/database-lab/v3/version"
3331
)
3432

3533
const (
@@ -46,36 +44,20 @@ type Config struct {
4644

4745
// Base provides cloning service.
4846
type Base struct {
49-
config *Config
50-
cloneMutex sync.RWMutex
51-
clones map[string]*CloneWrapper
52-
instanceStatus *models.InstanceStatus
53-
snapshotBox SnapshotBox
54-
provision *provision.Provisioner
55-
tm *telemetry.Agent
56-
observingCh chan string
47+
config *Config
48+
cloneMutex sync.RWMutex
49+
clones map[string]*CloneWrapper
50+
snapshotBox SnapshotBox
51+
provision *provision.Provisioner
52+
tm *telemetry.Agent
53+
observingCh chan string
5754
}
5855

5956
// NewBase instances a new Base service.
6057
func NewBase(cfg *Config, provision *provision.Provisioner, tm *telemetry.Agent, observingCh chan string) *Base {
6158
return &Base{
62-
config: cfg,
63-
clones: make(map[string]*CloneWrapper),
64-
instanceStatus: &models.InstanceStatus{
65-
Status: &models.Status{
66-
Code: models.StatusOK,
67-
Message: models.InstanceMessageOK,
68-
},
69-
Engine: models.Engine{
70-
Version: version.GetVersion(),
71-
StartedAt: pointer.ToTimeOrNil(time.Now().Truncate(time.Second)),
72-
Telemetry: pointer.ToBool(tm.IsEnabled()),
73-
},
74-
Cloning: models.Cloning{
75-
Clones: make([]*models.Clone, 0),
76-
},
77-
Provisioner: provision.ContainerOptions(),
78-
},
59+
config: cfg,
60+
clones: make(map[string]*CloneWrapper),
7961
provision: provision,
8062
tm: tm,
8163
observingCh: observingCh,
@@ -88,7 +70,6 @@ func NewBase(cfg *Config, provision *provision.Provisioner, tm *telemetry.Agent,
8870
// Reload reloads base cloning configuration.
8971
func (c *Base) Reload(cfg Config) {
9072
*c.config = cfg
91-
c.instanceStatus.Provisioner = c.provision.ContainerOptions()
9273
}
9374

9475
// Run initializes and runs cloning component.

‎internal/srv/server.go

Copy file name to clipboardExpand all lines: internal/srv/server.go
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Server struct {
5454
docker *client.Client
5555
pm *pool.Manager
5656
tm *telemetry.Agent
57+
startedAt *time.Time
5758
}
5859

5960
// NewServer initializes a new Server instance with provided configuration.
@@ -82,6 +83,7 @@ func NewServer(cfg *srvCfg.Config, globalCfg *global.Config,
8283
docker: dockerClient,
8384
pm: pm,
8485
tm: tm,
86+
startedAt: pointer.ToTimeOrNil(time.Now().Truncate(time.Second)),
8587
}
8688

8789
return server
@@ -95,7 +97,7 @@ func (s *Server) instanceStatus() *models.InstanceStatus {
9597
},
9698
Engine: models.Engine{
9799
Version: version.GetVersion(),
98-
StartedAt: pointer.ToTimeOrNil(time.Now().Truncate(time.Second)),
100+
StartedAt: s.startedAt,
99101
Telemetry: pointer.ToBool(s.tm.IsEnabled()),
100102
},
101103
Pools: s.provisioner.GetPoolEntryList(),

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.