Pg to bun (#148)

* start moving to bun

* changing more stuff

* more

* and yet more

* tests passing

* seems stable now

* more big changes

* small fix

* little fixes
This commit is contained in:
tobi 2021-08-25 15:34:33 +02:00 committed by GitHub
commit 2dc9fc1626
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
713 changed files with 98694 additions and 22704 deletions

View file

@ -19,6 +19,7 @@
package transport
import (
"context"
"crypto"
"fmt"
"sync"
@ -33,7 +34,7 @@ import (
// Controller generates transports for use in making federation requests to other servers.
type Controller interface {
NewTransport(pubKeyID string, privkey crypto.PrivateKey) (Transport, error)
NewTransportForUsername(username string) (Transport, error)
NewTransportForUsername(ctx context.Context, username string) (Transport, error)
}
type controller struct {
@ -90,7 +91,7 @@ func (c *controller) NewTransport(pubKeyID string, privkey crypto.PrivateKey) (T
}, nil
}
func (c *controller) NewTransportForUsername(username string) (Transport, error) {
func (c *controller) NewTransportForUsername(ctx context.Context, username string) (Transport, error) {
// We need an account to use to create a transport for dereferecing something.
// If a username has been given, we can fetch the account with that username and use it.
// Otherwise, we can take the instance account and use those credentials to make the request.
@ -101,7 +102,7 @@ func (c *controller) NewTransportForUsername(username string) (Transport, error)
u = username
}
ourAccount, err := c.db.GetLocalAccountByUsername(u)
ourAccount, err := c.db.GetLocalAccountByUsername(ctx, u)
if err != nil {
return nil, fmt.Errorf("error getting account %s from db: %s", username, err)
}