diff options
author | 2024-04-22 13:43:45 +0100 | |
---|---|---|
committer | 2024-04-22 13:43:45 +0100 | |
commit | 62788aa1165496555f9bb1702cd0a57f6819c562 (patch) | |
tree | b0a74b215bd934beeeb93f1d82864c45a6bdd421 | |
parent | [chore]: Bump github.com/miekg/dns from 1.1.58 to 1.1.59 (#2861) (diff) | |
download | gotosocial-62788aa1165496555f9bb1702cd0a57f6819c562.tar.xz |
[chore]: Bump codeberg.org/gruf/go-mutexes from 1.4.0 to 1.4.1 (#2860)
Bumps codeberg.org/gruf/go-mutexes from 1.4.0 to 1.4.1.
---
updated-dependencies:
- dependency-name: codeberg.org/gruf/go-mutexes
dependency-type: direct:production
update-type: version-update:semver-patch
...
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
-rw-r--r-- | go.mod | 2 | ||||
-rw-r--r-- | go.sum | 4 | ||||
-rw-r--r-- | vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go | 60 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
4 files changed, 8 insertions, 60 deletions
@@ -17,7 +17,7 @@ require ( codeberg.org/gruf/go-iotools v0.0.0-20230811115124-5d4223615a7f codeberg.org/gruf/go-kv v1.6.4 codeberg.org/gruf/go-logger/v2 v2.2.1 - codeberg.org/gruf/go-mutexes v1.4.0 + codeberg.org/gruf/go-mutexes v1.4.1 codeberg.org/gruf/go-runners v1.6.2 codeberg.org/gruf/go-sched v1.2.3 codeberg.org/gruf/go-store/v2 v2.2.4 @@ -64,8 +64,8 @@ codeberg.org/gruf/go-mangler v1.3.0 h1:cf0vuuLJuEhoIukPHj+MUBIQSWxZcfEYt2Eo/r7Rs codeberg.org/gruf/go-mangler v1.3.0/go.mod h1:jnOA76AQoaO2kTHi0DlTTVaFYfRM+9fzs8f4XO6MsOk= codeberg.org/gruf/go-maps v1.0.3 h1:VDwhnnaVNUIy5O93CvkcE2IZXnMB1+IJjzfop9V12es= codeberg.org/gruf/go-maps v1.0.3/go.mod h1:D5LNDxlC9rsDuVQVM6JObaVGAdHB6g2dTdOdkh1aXWA= -codeberg.org/gruf/go-mutexes v1.4.0 h1:53H6bFDRcG6rjk3iOTuGaStT/VTFdU5Uw8Dszy88a8g= -codeberg.org/gruf/go-mutexes v1.4.0/go.mod h1:1j/6/MBeBQUedAtAtysLLnBKogfOZAxdym0E3wlaBD8= +codeberg.org/gruf/go-mutexes v1.4.1 h1:SgsuktbbrkKYmgZ1reA5jMGEZbXJ6GQ54fSlKRN5iug= +codeberg.org/gruf/go-mutexes v1.4.1/go.mod h1:1j/6/MBeBQUedAtAtysLLnBKogfOZAxdym0E3wlaBD8= codeberg.org/gruf/go-runners v1.6.2 h1:oQef9niahfHu/wch14xNxlRMP8i+ABXH1Cb9PzZ4oYo= codeberg.org/gruf/go-runners v1.6.2/go.mod h1:Tq5PrZ/m/rBXbLZz0u5if+yP3nG5Sf6S8O/GnyEePeQ= codeberg.org/gruf/go-sched v1.2.3 h1:H5ViDxxzOBR3uIyGBCf0eH8b1L8wMybOXcdtUUTXZHk= diff --git a/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go b/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go index 03bf0e389..e00444b64 100644 --- a/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go +++ b/vendor/codeberg.org/gruf/go-mutexes/mutex_timeout.go @@ -1,7 +1,6 @@ package mutexes import ( - "sync" "time" ) @@ -78,60 +77,9 @@ func mutexTimeout(d time.Duration, unlock func(), fn func()) func() { return unlock } - // Acquire timer from pool - t := timerPool.Get().(*timer) + // Start timer to call fn. + t := time.AfterFunc(d, fn) - // Start the timer - go t.Start(d, fn) - - // Return func cancelling timeout, - // replacing Timeout in pool and - // finally unlocking mutex - return func() { - defer timerPool.Put(t) - t.Cancel() - unlock() - } -} - -// timerPool is the global &timer{} pool. -var timerPool = sync.Pool{ - New: func() interface{} { - t := time.NewTimer(time.Minute) - t.Stop() - return &timer{t: t, c: make(chan struct{})} - }, -} - -// timer represents a reusable cancellable timer. -type timer struct { - t *time.Timer - c chan struct{} -} - -// Start will start the timer with duration 'd', performing 'fn' on timeout. -func (t *timer) Start(d time.Duration, fn func()) { - t.t.Reset(d) - select { - // Timed out - case <-t.t.C: - fn() - - // Cancelled - case <-t.c: - } -} - -// Cancel will attempt to cancel the running timer. -func (t *timer) Cancel() { - select { - // cancel successful - case t.c <- struct{}{}: - if !t.t.Stop() { - <-t.t.C - } // stop timer - - // already stopped - default: - } + // Wrap unlock to stop mutex timer. + return func() { t.Stop(); unlock() } } diff --git a/vendor/modules.txt b/vendor/modules.txt index d12ee744f..be8513feb 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -46,7 +46,7 @@ codeberg.org/gruf/go-mangler # codeberg.org/gruf/go-maps v1.0.3 ## explicit; go 1.19 codeberg.org/gruf/go-maps -# codeberg.org/gruf/go-mutexes v1.4.0 +# codeberg.org/gruf/go-mutexes v1.4.1 ## explicit; go 1.14 codeberg.org/gruf/go-mutexes # codeberg.org/gruf/go-runners v1.6.2 |