MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / PublishStatuses

Method PublishStatuses

module/publish/iml.go:333–363  ·  view source on GitHub ↗
(ctx context.Context, serviceId string, id string)

Source from the content-addressed store, hash-verified

331}
332
333func (i *imlPublishModule) PublishStatuses(ctx context.Context, serviceId string, id string) ([]*dto.PublishStatus, error) {
334 _, err := i.serviceService.Check(ctx, serviceId, asServer)
335 if err != nil {
336 return nil, err
337 }
338 flow, err := i.publishService.Get(ctx, id)
339 if err != nil {
340 return nil, err
341 }
342 if flow.Service != serviceId {
343 return nil, errors.New("服务不一致")
344 }
345 list, err := i.publishService.GetPublishStatus(ctx, id)
346 if err != nil {
347 return nil, err
348 }
349 return utils.SliceToSlice(list, func(s *publish.Status) *dto.PublishStatus {
350 status := s.Status
351 errMsg := s.Error
352 if s.Status == publish.StatusPublishing && time.Now().Sub(s.UpdateAt) > 30*time.Second {
353 status = publish.StatusPublishError
354 errMsg = "发布超时"
355 }
356 return &dto.PublishStatus{
357 //Cluster: auto.UUID(s.Cluster),
358 Status: status.String(),
359 Error: errMsg,
360 }
361
362 }), nil
363}
364
365// Apply applies the changes to the imlPublishModule.
366//

Callers 1

DetailMethod · 0.95

Calls 4

CheckMethod · 0.65
GetMethod · 0.65
GetPublishStatusMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected