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:
Gabriel Adrian Samfira 2025-04-16 23:07:29 +00:00
parent a2aeac731c
commit 19ba210804
12 changed files with 118 additions and 19 deletions

View file

@ -402,6 +402,10 @@ type RunnerScaleSetMessage struct {
Statistics *RunnerScaleSetStatistic `json:"statistics"`
}
func (r RunnerScaleSetMessage) IsNil() bool {
return r.MessageID == 0 && r.MessageType == "" && r.Body == "" && r.Statistics == nil
}
func (r RunnerScaleSetMessage) GetJobsFromBody() ([]ScaleSetJobMessage, error) {
var body []ScaleSetJobMessage
if r.Body == "" {

View file

@ -472,6 +472,8 @@ type ScaleSet struct {
EnterpriseID string `json:"enterprise_id,omitempty"`
EnterpriseName string `json:"enterprise_name,omitempty"`
LastMessageID int64 `json:"-"`
}
func (p ScaleSet) GithubEntity() (GithubEntity, error) {