Compare commits
2 Commits
add-keyoxi
...
v0.0.9
| Author | SHA1 | Date | |
|---|---|---|---|
|
a3ee0b7900
|
|||
|
114c7101d6
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1 @@
|
|||||||
tools
|
tools
|
||||||
tmp
|
|
||||||
|
|||||||
@@ -206,6 +206,7 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri
|
|||||||
if err != nil && !errors.Is(err, ev.ErrNotFound) {
|
if err != nil && !errors.Is(err, ev.ErrNotFound) {
|
||||||
span.RecordError(fmt.Errorf("peer not found: %w", err))
|
span.RecordError(fmt.Errorf("peer not found: %w", err))
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
var req *Request
|
var req *Request
|
||||||
@@ -223,6 +224,7 @@ func (s *service) getPending(w http.ResponseWriter, r *http.Request, peerID stri
|
|||||||
if req == nil {
|
if req == nil {
|
||||||
span.RecordError(fmt.Errorf("request not found"))
|
span.RecordError(fmt.Errorf("request not found"))
|
||||||
w.WriteHeader(http.StatusNoContent)
|
w.WriteHeader(http.StatusNoContent)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
negotiator := contentnegotiation.NewNegotiator("application/json", "text/environment", "text/plain", "text/html")
|
negotiator := contentnegotiation.NewNegotiator("application/json", "text/environment", "text/plain", "text/html")
|
||||||
@@ -451,6 +453,7 @@ func (s *service) postResult(w http.ResponseWriter, r *http.Request, reqID strin
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
span.RecordError(fmt.Errorf("peer not found: %w", err))
|
span.RecordError(fmt.Errorf("peer not found: %w", err))
|
||||||
w.WriteHeader(http.StatusNotFound)
|
w.WriteHeader(http.StatusNotFound)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if peerResults.Has(reqID) {
|
if peerResults.Has(reqID) {
|
||||||
|
|||||||
@@ -4,10 +4,13 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
"log"
|
||||||
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
|
"go.sour.is/pkg/env"
|
||||||
"go.sour.is/pkg/lg"
|
"go.sour.is/pkg/lg"
|
||||||
"go.sour.is/pkg/service"
|
"go.sour.is/pkg/service"
|
||||||
)
|
)
|
||||||
@@ -27,6 +30,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
func run(ctx context.Context) error {
|
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{}
|
svc := &service.Harness{}
|
||||||
ctx, stop := lg.Init(ctx, appName)
|
ctx, stop := lg.Init(ctx, appName)
|
||||||
svc.OnStop(stop)
|
svc.OnStop(stop)
|
||||||
|
|||||||
1
tmp/build-errors.log
Normal file
1
tmp/build-errors.log
Normal file
@@ -0,0 +1 @@
|
|||||||
|
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
|
||||||
Reference in New Issue
Block a user