update cicd
This commit is contained in:
@@ -171,6 +171,88 @@ func (s *appServices) RetryAdminJob(ctx context.Context, req *appv1.RetryAdminJo
|
||||
}
|
||||
return &appv1.RetryAdminJobResponse{Job: buildAdminJob(job)}, nil
|
||||
}
|
||||
|
||||
func (s *appServices) ListAdminDlqJobs(ctx context.Context, req *appv1.ListAdminDlqJobsRequest) (*appv1.ListAdminDlqJobsResponse, error) {
|
||||
if _, err := s.requireAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.videoWorkflowService == nil {
|
||||
return nil, status.Error(codes.Unavailable, "Job service is unavailable")
|
||||
}
|
||||
offset := int(req.GetOffset())
|
||||
limit := int(req.GetLimit())
|
||||
items, total, err := s.videoWorkflowService.ListDLQ(ctx, offset, limit)
|
||||
if err != nil {
|
||||
return nil, status.Error(codes.Internal, "Failed to list DLQ jobs")
|
||||
}
|
||||
entries := make([]*appv1.AdminDlqEntry, 0, len(items))
|
||||
for _, item := range items {
|
||||
entries = append(entries, buildAdminDlqEntry(item))
|
||||
}
|
||||
return &appv1.ListAdminDlqJobsResponse{Items: entries, Total: total, Offset: int32(offset), Limit: int32(limit)}, nil
|
||||
}
|
||||
|
||||
func (s *appServices) GetAdminDlqJob(ctx context.Context, req *appv1.GetAdminDlqJobRequest) (*appv1.GetAdminDlqJobResponse, error) {
|
||||
if _, err := s.requireAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.videoWorkflowService == nil {
|
||||
return nil, status.Error(codes.Unavailable, "Job service is unavailable")
|
||||
}
|
||||
id := strings.TrimSpace(req.GetId())
|
||||
if id == "" {
|
||||
return nil, status.Error(codes.NotFound, "Job not found in DLQ")
|
||||
}
|
||||
item, err := s.videoWorkflowService.GetDLQ(ctx, id)
|
||||
if err != nil {
|
||||
if strings.Contains(strings.ToLower(err.Error()), "not found") {
|
||||
return nil, status.Error(codes.NotFound, "Job not found in DLQ")
|
||||
}
|
||||
return nil, status.Error(codes.Internal, "Failed to load DLQ job")
|
||||
}
|
||||
return &appv1.GetAdminDlqJobResponse{Item: buildAdminDlqEntry(item)}, nil
|
||||
}
|
||||
|
||||
func (s *appServices) RetryAdminDlqJob(ctx context.Context, req *appv1.RetryAdminDlqJobRequest) (*appv1.RetryAdminDlqJobResponse, error) {
|
||||
if _, err := s.requireAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.videoWorkflowService == nil {
|
||||
return nil, status.Error(codes.Unavailable, "Job service is unavailable")
|
||||
}
|
||||
id := strings.TrimSpace(req.GetId())
|
||||
if id == "" {
|
||||
return nil, status.Error(codes.NotFound, "Job not found in DLQ")
|
||||
}
|
||||
job, err := s.videoWorkflowService.RetryDLQ(ctx, id)
|
||||
if err != nil {
|
||||
if strings.Contains(strings.ToLower(err.Error()), "not found") {
|
||||
return nil, status.Error(codes.NotFound, "Job not found in DLQ")
|
||||
}
|
||||
return nil, status.Error(codes.FailedPrecondition, err.Error())
|
||||
}
|
||||
return &appv1.RetryAdminDlqJobResponse{Job: buildAdminJob(job)}, nil
|
||||
}
|
||||
|
||||
func (s *appServices) RemoveAdminDlqJob(ctx context.Context, req *appv1.RemoveAdminDlqJobRequest) (*appv1.RemoveAdminDlqJobResponse, error) {
|
||||
if _, err := s.requireAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if s.videoWorkflowService == nil {
|
||||
return nil, status.Error(codes.Unavailable, "Job service is unavailable")
|
||||
}
|
||||
id := strings.TrimSpace(req.GetId())
|
||||
if id == "" {
|
||||
return nil, status.Error(codes.NotFound, "Job not found in DLQ")
|
||||
}
|
||||
if err := s.videoWorkflowService.RemoveDLQ(ctx, id); err != nil {
|
||||
if strings.Contains(strings.ToLower(err.Error()), "not found") {
|
||||
return nil, status.Error(codes.NotFound, "Job not found in DLQ")
|
||||
}
|
||||
return nil, status.Error(codes.Internal, "Failed to remove DLQ job")
|
||||
}
|
||||
return &appv1.RemoveAdminDlqJobResponse{Status: "removed", JobId: id}, nil
|
||||
}
|
||||
func (s *appServices) ListAdminAgents(ctx context.Context, _ *appv1.ListAdminAgentsRequest) (*appv1.ListAdminAgentsResponse, error) {
|
||||
if _, err := s.requireAdmin(ctx); err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user