···28 if len(query.Labelers) > MaxLabelersPerQuery || len(query.Subjects) > MaxSubjectsPerQuery {
29 return &appreddwarflabelmerge.QueryLabels_Output{
30 Error: []*appreddwarflabelmerge.QueryLabels_Error{
31+ { // todo dont do this we should just throw error and not use the partial errors system
32 S: "too_many_labels_or_subjects",
33 E: ptrString(fmt.Sprintf("Labelers: %d, Subjects: %d", len(query.Labelers), len(query.Subjects))),
34 },
···65 }
6667 if result.Error != nil {
68+ for _, did := range result.Error.LabelerResolutionFailure {
69 out.Error = append(out.Error, &appreddwarflabelmerge.QueryLabels_Error{
70+ S: did,
71+ E: ptrString("labeler_resolution_failure"),
72 })
73 }
74+ for _, did := range result.Error.QueryLabelsTooManyPages {
75 out.Error = append(out.Error, &appreddwarflabelmerge.QueryLabels_Error{
76+ S: did,
77+ E: ptrString("too_many_pages"),
78 })
79 }
80+ for _, did := range result.Error.LabelerQueryFailure {
81 out.Error = append(out.Error, &appreddwarflabelmerge.QueryLabels_Error{
82+ S: did,
83+ E: ptrString("labeler_query_failure"),
84 })
85 }
86 }
···97 out := &appreddwarflabelmerge.QueryLabels_Output{
98 Error: []*appreddwarflabelmerge.QueryLabels_Error{
99 {
100+ S: "timeout", // todo dont do this we should explicitly point out the slow labeler and return the succesful labels
101 E: &timeoutMsg,
102 },
103 },
+13-2
cmd/labelmerge/main.go
···383 if err != nil {
384 log.Fatalf("Failed to initialize LRU cache: %v", err)
385 }
386- cache.SetCapacity(1000000)
387388 dir := identity.DefaultDirectory() // Cached with 24hr TTL
389···778 fullURL := baseURL + "?" + params.Encode()
779780 // Create HTTP request with timeout
781- ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
782 defer cancel()
783784 req, err := http.NewRequestWithContext(ctx, "GET", fullURL, nil)
···955}
956957func main() {
0958 log.SetFlags(log.LstdFlags | log.Lshortfile)
959960 service := NewLabelResolutionService()
···963 server := &Server{Service: service}
964965 e := echo.New()
00966 e.Use(middleware.Recover())
00000000967968 // your own routes
969 e.GET("/", server.root)