Several fixes
* Close response body in scaleset client * Wait for message listener loop to exit before attempting restart * Add LastMessageID field to scaleset model and function to update it Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
a2aeac731c
commit
19ba210804
12 changed files with 118 additions and 19 deletions
|
|
@ -118,6 +118,7 @@ type ScaleSet struct {
|
|||
OSType commonParams.OSType
|
||||
OSArch commonParams.OSArch
|
||||
Enabled bool
|
||||
LastMessageID int64
|
||||
// ExtraSpecs is an opaque json that gets sent to the provider
|
||||
// as part of the bootstrap params for instances. It can contain
|
||||
// any kind of data needed by providers.
|
||||
|
|
|
|||
|
|
@ -379,3 +379,15 @@ func (s *sqlDatabase) DeleteScaleSetByID(ctx context.Context, scaleSetID uint) (
|
|||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *sqlDatabase) SetScaleSetLastMessageID(ctx context.Context, scaleSetID uint, lastMessageID int64) error {
|
||||
if err := s.conn.Transaction(func(tx *gorm.DB) error {
|
||||
if q := tx.Model(&ScaleSet{}).Where("id = ?", scaleSetID).Update("last_message_id", lastMessageID); q.Error != nil {
|
||||
return errors.Wrap(q.Error, "saving database entry")
|
||||
}
|
||||
return nil
|
||||
}); err != nil {
|
||||
return errors.Wrap(err, "setting last message ID")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -309,6 +309,7 @@ func (s *sqlDatabase) sqlToCommonScaleSet(scaleSet ScaleSet) (params.ScaleSet, e
|
|||
GitHubRunnerGroup: scaleSet.GitHubRunnerGroup,
|
||||
State: scaleSet.State,
|
||||
ExtendedState: scaleSet.ExtendedState,
|
||||
LastMessageID: scaleSet.LastMessageID,
|
||||
}
|
||||
|
||||
if scaleSet.RepoID != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue