mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-02 18:22:17 +01:00
initial v0.8 pre-release
This commit is contained in:
1 parent
9cbb2e750e
commit
90dba45d7c
388 files changed
+21574
-13597
No files matched your search
+2
-2
@@ -54,12 +54,12 @@ func (h *Hook[T]) Reset() {
|
||||
// - hook.StopPropagation is returned in one of the handlers
|
||||
// - any non-nil error is returned in one of the handlers
|
||||
func (h *Hook[T]) Trigger(data T, oneOffHandlers ...Handler[T]) error {
|
||||
h.mux.Lock()
|
||||
h.mux.RLock()
|
||||
handlers := make([]Handler[T], 0, len(h.handlers)+len(oneOffHandlers))
|
||||
handlers = append(handlers, h.handlers...)
|
||||
handlers = append(handlers, oneOffHandlers...)
|
||||
// unlock is not deferred to avoid deadlocks when Trigger is called recursive by the handlers
|
||||
h.mux.Unlock()
|
||||
h.mux.RUnlock()
|
||||
|
||||
for _, fn := range handlers {
|
||||
err := fn(data)
|
||||
|
||||
Reference in new issue
Block a user