diff options
author | 2024-02-07 14:43:27 +0000 | |
---|---|---|
committer | 2024-02-07 14:43:27 +0000 | |
commit | 6738fd5bb0193daf3e2b524105ff690e8bfc32f4 (patch) | |
tree | 1c9b84846e21c737746f2a528170ad1d4bfb0a1c /internal/db/bundb/account.go | |
parent | [bugfix] Ensure activities sender always = activities actor (#2608) (diff) | |
download | gotosocial-6738fd5bb0193daf3e2b524105ff690e8bfc32f4.tar.xz |
[feature/performance] sqlite pragma optimize on close (#2596)
* wrap database drivers in order to handle error processing, hooks, etc
* remove dead code
* add code comment, remove unused blank imports
Diffstat (limited to 'internal/db/bundb/account.go')
-rw-r--r-- | internal/db/bundb/account.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/internal/db/bundb/account.go b/internal/db/bundb/account.go index 705e1b118..4b4c78726 100644 --- a/internal/db/bundb/account.go +++ b/internal/db/bundb/account.go @@ -37,7 +37,7 @@ import ( ) type accountDB struct { - db *DB + db *bun.DB state *state.State } @@ -334,7 +334,7 @@ func (a *accountDB) PutAccount(ctx context.Context, account *gtsmodel.Account) e // It is safe to run this database transaction within cache.Store // as the cache does not attempt a mutex lock until AFTER hook. // - return a.db.RunInTx(ctx, func(tx Tx) error { + return a.db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { // create links between this account and any emojis it uses for _, i := range account.EmojiIDs { if _, err := tx.NewInsert().Model(>smodel.AccountToEmoji{ @@ -363,7 +363,7 @@ func (a *accountDB) UpdateAccount(ctx context.Context, account *gtsmodel.Account // It is safe to run this database transaction within cache.Store // as the cache does not attempt a mutex lock until AFTER hook. // - return a.db.RunInTx(ctx, func(tx Tx) error { + return a.db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { // create links between this account and any emojis it uses // first clear out any old emoji links if _, err := tx. @@ -411,7 +411,7 @@ func (a *accountDB) DeleteAccount(ctx context.Context, id string) error { return err } - return a.db.RunInTx(ctx, func(tx Tx) error { + return a.db.RunInTx(ctx, nil, func(ctx context.Context, tx bun.Tx) error { // clear out any emoji links if _, err := tx. NewDelete(). |