(ctx context.Context, service string, serviceId string, applicationId string)
| 284 | } |
| 285 | |
| 286 | func (i *imlSubscribeModule) DeleteSubscriber(ctx context.Context, service string, serviceId string, applicationId string) error { |
| 287 | _, err := i.serviceService.Get(ctx, service) |
| 288 | if err != nil { |
| 289 | return err |
| 290 | } |
| 291 | clusters, err := i.clusterService.List(ctx) |
| 292 | if err != nil { |
| 293 | return err |
| 294 | } |
| 295 | |
| 296 | return i.transaction.Transaction(ctx, func(ctx context.Context) error { |
| 297 | list, err := i.subscribeService.ListByApplication(ctx, serviceId, applicationId) |
| 298 | if err != nil { |
| 299 | return err |
| 300 | } |
| 301 | releaseInfo := &gateway.SubscribeRelease{ |
| 302 | Service: serviceId, |
| 303 | Application: applicationId, |
| 304 | } |
| 305 | for _, s := range list { |
| 306 | err = i.subscribeService.Delete(ctx, s.Id) |
| 307 | if err != nil { |
| 308 | return err |
| 309 | } |
| 310 | } |
| 311 | for _, c := range clusters { |
| 312 | err = i.offlineForCluster(ctx, c.Uuid, releaseInfo) |
| 313 | if err != nil { |
| 314 | return fmt.Errorf("offline subscribe for cluster[%s] %s", c.Uuid, err) |
| 315 | } |
| 316 | } |
| 317 | return nil |
| 318 | }) |
| 319 | } |
| 320 | func (i *imlSubscribeModule) offlineForCluster(ctx context.Context, clusterId string, config *gateway.SubscribeRelease) error { |
| 321 | |
| 322 | client, err := i.clusterService.GatewayClient(ctx, clusterId) |
nothing calls this directly
no test coverage detected