gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit fc9038d8e41310df51dfcad847a605ebb3010dc3
parent bcb80d3ff4a669d52d63950c8830427646c05884
Author: kim <89579420+NyaaaWhatsUpDoc@users.noreply.github.com>
Date:   Sat,  5 Nov 2022 12:13:07 +0000

bump dependencies (#959)

Signed-off-by: kim <grufwub@gmail.com>

Signed-off-by: kim <grufwub@gmail.com>
Diffstat:
Mgo.mod | 4++--
Mgo.sum | 10++++------
Mvendor/codeberg.org/gruf/go-mutexes/map.go | 80++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
Mvendor/modules.txt | 4++--
4 files changed, 57 insertions(+), 41 deletions(-)

diff --git a/go.mod b/go.mod @@ -10,9 +10,9 @@ require ( codeberg.org/gruf/go-errors/v2 v2.0.2 codeberg.org/gruf/go-kv v1.5.2 codeberg.org/gruf/go-logger/v2 v2.2.1 - codeberg.org/gruf/go-mutexes v1.1.2 + codeberg.org/gruf/go-mutexes v1.1.3 codeberg.org/gruf/go-runners v1.3.1 - codeberg.org/gruf/go-store/v2 v2.0.3 + codeberg.org/gruf/go-store/v2 v2.0.4 github.com/buckket/go-blurhash v1.1.0 github.com/coreos/go-oidc/v3 v3.4.0 github.com/disintegration/imaging v1.6.2 diff --git a/go.sum b/go.sum @@ -87,18 +87,16 @@ codeberg.org/gruf/go-kv v1.5.2 h1:B0RkAXLUXYn3Za1NzTXOcUvAc+JUC2ZadTMkCUDa0mc= codeberg.org/gruf/go-kv v1.5.2/go.mod h1:al6ASW/2CbGqz2YcM8B00tvWnVi1bU1CH3HYs5tZxo4= codeberg.org/gruf/go-logger/v2 v2.2.1 h1:RP2u059EQKTBFV3cN8X6xDxNk2RkzqdgXGKflKqB7Oc= codeberg.org/gruf/go-logger/v2 v2.2.1/go.mod h1:m/vBfG5jNUmYXI8Hg9aVSk7Pn8YgEBITQB/B/CzdRss= -codeberg.org/gruf/go-mutexes v1.1.2 h1:AMC1CFV6kMi+iBjR3yQv8yIagG3lWm68U6sQHYFHEf4= -codeberg.org/gruf/go-mutexes v1.1.2/go.mod h1:1j/6/MBeBQUedAtAtysLLnBKogfOZAxdym0E3wlaBD8= +codeberg.org/gruf/go-mutexes v1.1.3 h1:6es80V7De7mh5XCfSUzLL5/QlJQsV6+UZkK7Ljq1tew= +codeberg.org/gruf/go-mutexes v1.1.3/go.mod h1:1j/6/MBeBQUedAtAtysLLnBKogfOZAxdym0E3wlaBD8= codeberg.org/gruf/go-pools v1.1.0 h1:LbYP24eQLl/YI1fSU2pafiwhGol1Z1zPjRrMsXpF88s= codeberg.org/gruf/go-pools v1.1.0/go.mod h1:ZMYpt/DjQWYC3zFD3T97QWSFKs62zAUGJ/tzvgB9D68= codeberg.org/gruf/go-runners v1.3.1 h1:d/OQMMMiA6yPaDSbSr0/Jc+lucWmm7AiAZjWffpNKVQ= codeberg.org/gruf/go-runners v1.3.1/go.mod h1:rl0EdZNozkRMb21DAtOL5L4oTfmslYQdZgq2RMMc/H4= codeberg.org/gruf/go-sched v1.1.1 h1:YtLSQhpypzuD3HTup5oF7LLWB79gTL4nqW06kH4Vwks= codeberg.org/gruf/go-sched v1.1.1/go.mod h1:SRcdP/5qim+EBT3n3r4aUra1C30yPqV4OJOXuqvgdQM= -codeberg.org/gruf/go-store/v2 v2.0.2 h1:SZiEchrX9BCLr++dlz21XnoCEZi9u4j/svNQ/FDqC7s= -codeberg.org/gruf/go-store/v2 v2.0.2/go.mod h1:bgHRkBHkYpnhbCX0c8wBOVK9X7zOvLBepi9MSgRDlDs= -codeberg.org/gruf/go-store/v2 v2.0.3 h1:htjXCThi53bmqPYmtrc5aiWOjW4yN5tlHSPRLtsOGgY= -codeberg.org/gruf/go-store/v2 v2.0.3/go.mod h1:bgHRkBHkYpnhbCX0c8wBOVK9X7zOvLBepi9MSgRDlDs= +codeberg.org/gruf/go-store/v2 v2.0.4 h1:CpGkJUz7qINh3krjtR6dKmKwJKjprbEKKq4dWF+AemI= +codeberg.org/gruf/go-store/v2 v2.0.4/go.mod h1:vKId86ET4ZzG1tE1dMNkfV66rZkcsyqt64UhKt6EYfc= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= diff --git a/vendor/codeberg.org/gruf/go-mutexes/map.go b/vendor/codeberg.org/gruf/go-mutexes/map.go @@ -134,7 +134,7 @@ func NewMap(max, wake int32) MutexMap { } } -// MAX sets the MutexMap max open locks and wake modulus, returns current values. +// SET sets the MutexMap max open locks and wake modulus, returns current values. // For values less than zero defaults are set, and zero is non-op. func (mm *MutexMap) SET(max, wake int32) (int32, int32) { mm.mapmu.Lock() @@ -257,7 +257,7 @@ func (mm *MutexMap) lock(key string, lt uint8) func() { return func() { mm.mapmu.Lock() mu.Unlock() - go mm.cleanup() + mm.cleanup() } } @@ -289,34 +289,46 @@ func (mm *MutexMap) cleanup() { // Decr count mm.count-- - if mm.count%mm.wake == 0 { - // Notify queued routines - for _, mu := range mm.queue { - mu.Unlock() - } + // Calculate current wake modulus + wakemod := mm.count % mm.wake - // Reset queue - mm.queue = mm.queue[:0] + if mm.count != 0 && wakemod != 0 { + // Fast path => no cleanup. + // Unlock, return early + mm.mapmu.Unlock() + return } - if mm.count < 1 { - // Perform evictions - for _, mu := range mm.evict { - key := mu.key - mu.key = "" - delete(mm.mumap, key) - mm.mpool.Release(mu) + go func() { + if wakemod == 0 { + // Notify queued routines + for _, mu := range mm.queue { + mu.Unlock() + } + + // Reset queue + mm.queue = mm.queue[:0] } - // Reset map state - mm.evict = mm.evict[:0] - mm.state = stateUnlockd - mm.mpool.GC() - mm.qpool.GC() - } + if mm.count == 0 { + // Perform evictions + for _, mu := range mm.evict { + key := mu.key + mu.key = "" + delete(mm.mumap, key) + mm.mpool.Release(mu) + } - // Unlock map - mm.mapmu.Unlock() + // Reset map state + mm.evict = mm.evict[:0] + mm.state = stateUnlockd + mm.mpool.GC() + mm.qpool.GC() + } + + // Unlock map + mm.mapmu.Unlock() + }() } // RLockMap acquires a read lock over the entire map, returning a lock state for acquiring key read locks. @@ -421,7 +433,7 @@ func (st *LockState) lock(key string, lt uint8) func() { return func() { st.mmap.mapmu.Lock() mu.Unlock() - go st.mmap.cleanup() + st.mmap.cleanup() st.wait.Add(-1) } } @@ -433,7 +445,7 @@ func (st *LockState) UnlockMap() { } st.wait.Wait() st.mmap.mapmu.Lock() - go st.mmap.cleanup() + st.mmap.cleanup() } // rwmutex is a very simple *representation* of a read-write @@ -441,9 +453,9 @@ func (st *LockState) UnlockMap() { // tracking the lock state for a given map key, which is // protected by the map's mutex. type rwmutex struct { - rcnt uint32 - lock uint8 - key string + rcnt int32 // read lock count + lock uint8 // lock type + key string // map key } func (mu *rwmutex) CanLock(lt uint8) bool { @@ -452,15 +464,21 @@ func (mu *rwmutex) CanLock(lt uint8) bool { } func (mu *rwmutex) Lock(lt uint8) { + // Set lock type mu.lock = lt + if lt&lockTypeRead != 0 { + // RLock, increment mu.rcnt++ } } func (mu *rwmutex) Unlock() { - mu.rcnt-- - if mu.rcnt == 0 { + if mu.rcnt > 0 { + // RUnlock + mu.rcnt-- + } else { + // Total unlock mu.lock = 0 } } diff --git a/vendor/modules.txt b/vendor/modules.txt @@ -38,7 +38,7 @@ codeberg.org/gruf/go-kv/format # codeberg.org/gruf/go-logger/v2 v2.2.1 ## explicit; go 1.19 codeberg.org/gruf/go-logger/v2/level -# codeberg.org/gruf/go-mutexes v1.1.2 +# codeberg.org/gruf/go-mutexes v1.1.3 ## explicit; go 1.14 codeberg.org/gruf/go-mutexes # codeberg.org/gruf/go-pools v1.1.0 @@ -50,7 +50,7 @@ codeberg.org/gruf/go-runners # codeberg.org/gruf/go-sched v1.1.1 ## explicit; go 1.19 codeberg.org/gruf/go-sched -# codeberg.org/gruf/go-store/v2 v2.0.3 +# codeberg.org/gruf/go-store/v2 v2.0.4 ## explicit; go 1.19 codeberg.org/gruf/go-store/v2/kv codeberg.org/gruf/go-store/v2/storage