GODT-2037: Handle and log API refresh event

This commit is contained in:
James Houlahan
2022-11-10 23:28:08 +01:00
parent 2023df3ef8
commit 59278913ca
12 changed files with 192 additions and 64 deletions

View File

@ -20,6 +20,7 @@ package bridge_test
import (
"context"
"crypto/tls"
"fmt"
"net/http"
"os"
"sync"
@ -536,3 +537,22 @@ func getConnectedUserIDs(t *testing.T, bridge *bridge.Bridge) []string {
return info.Connected
})
}
func chToType[In, Out any](inCh <-chan In, done func()) (<-chan Out, func()) {
outCh := make(chan Out)
go func() {
defer close(outCh)
for in := range inCh {
out, ok := any(in).(Out)
if !ok {
panic(fmt.Sprintf("unexpected type %T", in))
}
outCh <- out
}
}()
return outCh, done
}