This commit is contained in:
Rob Watson 2021-11-13 19:52:49 +01:00
parent cd2686a5b2
commit fec542ee62
2 changed files with 2 additions and 7 deletions

View File

@ -23,11 +23,6 @@ type uploadResult struct {
size int64 size int64
} }
type readResult struct {
n int
err error
}
const ( const (
targetPartSizeBytes = 5 * 1024 * 1024 // 5MB targetPartSizeBytes = 5 * 1024 * 1024 // 5MB
readBufferSizeBytes = 32_768 // 32Kb readBufferSizeBytes = 32_768 // 32Kb

View File

@ -27,7 +27,7 @@ func init() {
const ( const (
// ts-proto generates code that automatically retries for a subset of gRPC // ts-proto generates code that automatically retries for a subset of gRPC
// response codes. To avoid invoking this behaviour, default to returning a // response codes. To avoid invoking this behaviour, default to returning a
// Cancelled code. Later, // Cancelled code for now.
// See https://github.com/stephenh/ts-proto/blob/459b94f5b2988d58d186461332e888c3e511603a/src/generate-grpc-web.ts#L293 // See https://github.com/stephenh/ts-proto/blob/459b94f5b2988d58d186461332e888c3e511603a/src/generate-grpc-web.ts#L293
// and https://github.com/stephenh/ts-proto/pull/131. // and https://github.com/stephenh/ts-proto/pull/131.
defaultResponseCode = codes.Canceled defaultResponseCode = codes.Canceled
@ -146,7 +146,7 @@ func Start(options Options) error {
pbMediaSet.RegisterMediaSetServiceServer(grpcServer, &mediaSetServiceController{mediaSetService: fetchMediaSetService}) pbMediaSet.RegisterMediaSetServiceServer(grpcServer, &mediaSetServiceController{mediaSetService: fetchMediaSetService})
// TODO: proper CORS support // TODO: configure CORS
grpcWebServer := grpcweb.WrapServer(grpcServer, grpcweb.WithOriginFunc(func(string) bool { return true })) grpcWebServer := grpcweb.WrapServer(grpcServer, grpcweb.WithOriginFunc(func(string) bool { return true }))
handler := func(w http.ResponseWriter, r *http.Request) { handler := func(w http.ResponseWriter, r *http.Request) {
grpcWebServer.ServeHTTP(w, r) grpcWebServer.ServeHTTP(w, r)