Skip to content

Navigation Menu

Sign in
Appearance settings

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 dda4ea0

Browse filesBrowse files
committed
Merge branch '316-clean-up-failed-clones' into 'master'
feat: clean up failed clones (#316) * remove clone with the FATAL status during idleness check * correctly count a number of clones related to snapshot Closes #316 See merge request postgres-ai/database-lab!405
2 parents 1a178a3 + 3803738 commit dda4ea0
Copy full SHA for dda4ea0

File tree

1 file changed

+6
-2
lines changed
Filter options

1 file changed

+6
-2
lines changed

‎internal/cloning/base.go

Copy file name to clipboardExpand all lines: internal/cloning/base.go
+6-2Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ func (c *Base) CreateClone(cloneRequest *types.CloneCreateRequest) (*models.Clon
181181
AvailableDB: cloneRequest.DB.DBName,
182182
}
183183

184+
c.incrementCloneNumber(clone.Snapshot.ID)
185+
184186
go func() {
185187
session, err := c.provision.StartSession(clone.Snapshot.ID, ephemeralUser, cloneRequest.ExtraConf)
186188
if err != nil {
@@ -216,7 +218,6 @@ func (c *Base) fillCloneSession(cloneID string, session *resources.Session) {
216218

217219
w.Session = session
218220
w.TimeStartedAt = time.Now()
219-
c.incrementCloneNumber(w.Clone.Snapshot.ID)
220221

221222
clone := w.Clone
222223
clone.Status = models.Status{
@@ -621,8 +622,11 @@ func (c *Base) isIdleClone(wrapper *CloneWrapper) (bool, error) {
621622

622623
session := wrapper.Session
623624

624-
// TODO(akartasov): Remove wrappers without session.
625625
if session == nil {
626+
if wrapper.Clone.Status.Code == models.StatusFatal {
627+
return true, nil
628+
}
629+
626630
return false, errors.New("failed to get clone session")
627631
}
628632

0 commit comments

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