Skip to content

Commit

Permalink
perf: Only instantiate convert hook once
Browse files Browse the repository at this point in the history
  • Loading branch information
gabe565 committed Apr 4, 2024
1 parent f7a43f4 commit 0a84cb1
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ func main() {
return nil
})

app.OnModelAfterCreate("sounds").Add(hooks.Convert(app))
app.OnModelAfterUpdate("sounds").Add(hooks.Convert(app))
convertHook := hooks.Convert(app)
app.OnModelAfterCreate("sounds").Add(convertHook)
app.OnModelAfterUpdate("sounds").Add(convertHook)

app.OnBeforeServe().Add(func(_ *core.ServeEvent) error {
go func() {
Expand Down

0 comments on commit 0a84cb1

Please sign in to comment.