mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Reorg
This commit is contained in:
28
pkg/api/resolver_subscription_metadata.go
Normal file
28
pkg/api/resolver_subscription_metadata.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/stashapp/stash/pkg/manager"
|
||||
"time"
|
||||
)
|
||||
|
||||
func (r *subscriptionResolver) MetadataUpdate(ctx context.Context) (<-chan string, error) {
|
||||
msg := make(chan string, 1)
|
||||
|
||||
ticker := time.NewTicker(5 * time.Second)
|
||||
|
||||
go func() {
|
||||
for {
|
||||
select {
|
||||
case _ = <-ticker.C:
|
||||
manager.GetInstance().HandleMetadataUpdateSubscriptionTick(msg)
|
||||
case <-ctx.Done():
|
||||
ticker.Stop()
|
||||
close(msg)
|
||||
return
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
||||
return msg, nil
|
||||
}
|
||||
Reference in New Issue
Block a user