@@ -99,6 +99,7 @@ func (c *UpdaterClient) CheckUpdate() error {
9999 newUpdate ["version" ] = update .Version .Version
100100 newUpdate ["edition" ] = update .Instance .Edition
101101 newUpdate ["changelog" ] = update .Version .Changelog
102+ newUpdate ["id" ] = update .ID
102103 updates = append (updates , newUpdate )
103104 }
104105 } else {
@@ -110,6 +111,7 @@ func (c *UpdaterClient) CheckUpdate() error {
110111 newUpdate ["version" ] = v
111112 newUpdate ["edition" ] = "enterprise"
112113 newUpdate ["changelog" ] = "No changelog available for offline version"
114+ newUpdate ["id" ] = "offline"
113115 updates = append (updates , newUpdate )
114116 }
115117
@@ -124,6 +126,12 @@ func (c *UpdaterClient) CheckUpdate() error {
124126 if err != nil {
125127 return fmt .Errorf ("error updating to new version: %v" , err )
126128 }
129+ if update ["id" ] != "offline" {
130+ err = c .MarkUpdateSent (update ["id" ])
131+ if err != nil {
132+ return fmt .Errorf ("error marking update as sent: %v" , err )
133+ }
134+ }
127135 }
128136 }
129137
@@ -155,6 +163,21 @@ func (c *UpdaterClient) UpdateToNewVersion(version, edition, changelog string) e
155163 return nil
156164}
157165
166+ func (c * UpdaterClient ) MarkUpdateSent (updateId string ) error {
167+ url := fmt .Sprintf ("%s%s?id=%s" , c .Config .Server , config .SetUpdateSentEndpoint , updateId )
168+ _ , status , err := utils .DoReq [any ](
169+ url ,
170+ nil ,
171+ http .MethodPost ,
172+ map [string ]string {"id" : c .Config .InstanceID , "key" : c .Config .InstanceKey },
173+ nil ,
174+ )
175+ if err != nil || status != http .StatusOK {
176+ return fmt .Errorf ("error marking update as sent: status: %d, error: %v" , status , err )
177+ }
178+ return nil
179+ }
180+
158181func (c * UpdaterClient ) UploadLogs (ctx context.Context , path string ) error {
159182 url := fmt .Sprintf ("%s%s" , c .Config .Server , config .LogCollectorEndpoint )
160183
0 commit comments