v0.0.592
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 3m30s

This commit is contained in:
Mike Schwörer 2025-07-16 12:46:18 +02:00
parent 64f2cd7219
commit 52e74b59f5
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 11 additions and 8 deletions

View File

@ -10,6 +10,15 @@ import (
"time" "time"
) )
// PubSub is a simple Pub/Sub Broker
// Clients can subscribe to a namespace and receive published messages on this namespace
// Messages are broadcast to all subscribers
type PubSub[T any] struct {
masterLock *sync.Mutex
subscriptions map[string][]*pubSubSubscription[T]
}
type PubSubSubscription interface { type PubSubSubscription interface {
Unsubscribe() Unsubscribe()
} }
@ -32,12 +41,6 @@ func (p *pubSubSubscription[T]) Unsubscribe() {
p.parent.unsubscribe(p) p.parent.unsubscribe(p)
} }
type PubSub[T any] struct {
masterLock *sync.Mutex
subscriptions map[string][]*pubSubSubscription[T]
}
func NewPubSub[T any](capacity int) *PubSub[T] { func NewPubSub[T any](capacity int) *PubSub[T] {
return &PubSub[T]{ return &PubSub[T]{
masterLock: &sync.Mutex{}, masterLock: &sync.Mutex{},

View File

@ -1,5 +1,5 @@
package goext package goext
const GoextVersion = "0.0.591" const GoextVersion = "0.0.592"
const GoextVersionTimestamp = "2025-07-16T12:44:55+0200" const GoextVersionTimestamp = "2025-07-16T12:46:18+0200"