1 Commits

Author SHA1 Message Date
xuu
bb7f6b3878 chore: add keyoxide 2023-10-04 15:07:41 -06:00
8 changed files with 4 additions and 17 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
tools
tmp

View File

@@ -179,7 +179,7 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri
return nil
})
if err != nil {
span.AddEvent(err.Error())
span.RecordError(err)
w.WriteHeader(http.StatusNotFound)
return
}
@@ -204,9 +204,8 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri
peerResults.SetStreamID(aggPeer(peerID))
err = s.es.Load(ctx, peerResults)
if err != nil && !errors.Is(err, ev.ErrNotFound) {
span.AddEvent("peer not found")
span.RecordError(fmt.Errorf("peer not found: %w", err))
w.WriteHeader(http.StatusNotFound)
return
}
var req *Request
@@ -222,9 +221,8 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri
}
}
if req == nil {
span.AddEvent("request not found")
span.RecordError(fmt.Errorf("request not found"))
w.WriteHeader(http.StatusNoContent)
return
}
negotiator := contentnegotiation.NewNegotiator("application/json", "text/environment", "text/plain", "text/html")
@@ -453,7 +451,6 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin
if err != nil {
span.RecordError(fmt.Errorf("peer not found: %w", err))
w.WriteHeader(http.StatusNotFound)
return
}
if peerResults.Has(reqID) {

View File

@@ -4,13 +4,10 @@ import (
"context"
"errors"
"log"
"log/slog"
"net/http"
"os"
"os/signal"
"strconv"
"go.sour.is/pkg/env"
"go.sour.is/pkg/lg"
"go.sour.is/pkg/service"
)
@@ -30,13 +27,6 @@ func main() {
}
}
func run(ctx context.Context) error {
// TODO: make this configurable.
level := slog.LevelError
if ok, _ := strconv.ParseBool(env.Default("LOG_DEBUG", "FALSE")); ok {
level = slog.LevelDebug
}
slog.SetDefault(slog.New(slog.NewTextHandler(os.Stdout, &slog.HandlerOptions{Level: level})))
svc := &service.Harness{}
ctx, stop := lg.Init(ctx, appName)
svc.OnStop(stop)

View File

@@ -1 +0,0 @@
exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1

BIN
tmp/main

Binary file not shown.