more customer
Build and Publish / BuildAndDeployAmd64 (push) Failing after 5s
Build and Publish / BuildAndDeployArm64 (push) Failing after 6s

This commit is contained in:
2026-06-26 19:49:54 +02:00
parent 0252893de5
commit 3df95eac90
8 changed files with 836 additions and 12 deletions
+7 -2
View File
@@ -43,6 +43,9 @@ type GrainPoolConfig[V any] struct {
Hostname string
Spawn func(ctx context.Context, id uint64) (Grain[V], error)
SpawnHost func(host string) (Host[V], error)
// Destroy is an optional cleanup hook called when a grain is evicted on TTL
// (e.g. to detach inventory subscriptions wired into its mutations). Leave
// nil when there is nothing to clean up — purge() skips a nil Destroy.
Destroy func(grain Grain[V]) error
TTL time.Duration
PoolSize int
@@ -96,8 +99,10 @@ func (p *SimpleGrainPool[V]) purge() {
for id, grain := range p.grains {
if grain.GetLastAccess().Before(purgeLimit) {
purgedIds = append(purgedIds, id)
if err := p.destroy(grain); err != nil {
log.Printf("failed to destroy grain %d: %v", id, err)
if p.destroy != nil {
if err := p.destroy(grain); err != nil {
log.Printf("failed to destroy grain %d: %v", id, err)
}
}
delete(p.grains, id)