- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 19 for InitOnce (0.07 sec)
-
internal/cachevalue/cache_test.go
defer sl.Stop() select { case <-sl.C: case <-ctx.Done(): return ctx.Err() } return nil } func TestCacheCtx(t *testing.T) { cache := New[time.Time]() t.Parallel() cache.InitOnce(2*time.Second, Opts{}, func(ctx context.Context) (time.Time, error) { return time.Now(), slowCaller(ctx) }, ) ctx, cancel := context.WithCancel(context.Background()) cancel() // cancel context to test.
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Thu May 09 00:51:34 UTC 2024 - 2.7K bytes - Viewed (0) -
internal/cachevalue/cache.go
return &Cache[T]{ ttl: ttl, updateFn: update, opts: opts, } } // InitOnce initializes the cache with a TTL and an update function. It is // guaranteed to be called only once. func (t *Cache[T]) InitOnce(ttl time.Duration, opts Opts, update func(ctx context.Context) (T, error)) { t.Once.Do(func() { t.ttl = ttl t.updateFn = update t.opts = opts })
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri May 24 12:50:46 UTC 2024 - 4.4K bytes - Viewed (0) -
internal/event/target/nsq.go
} if n.QueueDir != "" { if !filepath.IsAbs(n.QueueDir) { return errors.New("queueDir path should be absolute") } } return nil } // NSQTarget - NSQ target. type NSQTarget struct { initOnce once.Init id event.TargetID args NSQArgs producer *nsq.Producer store store.Store[event.Event] config *nsq.Config loggerOnce logger.LogOnce quitCh chan struct{} }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 7.1K bytes - Viewed (0) -
internal/event/target/redis.go
return fmt.Errorf("expected type %v does not match with available type %v", expectedType, typeAvailable) } } return nil } // RedisTarget - Redis target. type RedisTarget struct { initOnce once.Init id event.TargetID args RedisArgs pool *redis.Pool store store.Store[event.Event] firstPing bool loggerOnce logger.LogOnce quitCh chan struct{} }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 9.1K bytes - Viewed (0) -
internal/event/target/webhook.go
return errors.New("cert and key must be specified as a pair") } return nil } // WebhookTarget - Webhook target. type WebhookTarget struct { initOnce once.Init id event.TargetID args WebhookArgs transport *http.Transport httpClient *http.Client store store.Store[event.Event] loggerOnce logger.LogOnce
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 8.8K bytes - Viewed (0) -
internal/event/target/amqp.go
if !filepath.IsAbs(a.QueueDir) { return errors.New("queueDir path should be absolute") } } return nil } // AMQPTarget - AMQP target type AMQPTarget struct { initOnce once.Init id event.TargetID args AMQPArgs conn *amqp091.Connection connMutex sync.Mutex store store.Store[event.Event] loggerOnce logger.LogOnce
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 10K bytes - Viewed (0) -
internal/event/target/kafka.go
return errors.New("batch commit timeout should be set only if queue dir is enabled and batch size > 1") } } return nil } // KafkaTarget - Kafka target. type KafkaTarget struct { initOnce once.Init id event.TargetID args KafkaArgs client sarama.Client producer sarama.SyncProducer config *sarama.Config store store.Store[event.Event]
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 13.6K bytes - Viewed (0) -
internal/event/target/postgresql.go
if p.MaxOpenConnections < 0 { return errors.New("maxOpenConnections cannot be less than zero") } return nil } // PostgreSQLTarget - PostgreSQL target. type PostgreSQLTarget struct { initOnce once.Init id event.TargetID args PostgreSQLArgs updateStmt *sql.Stmt deleteStmt *sql.Stmt insertStmt *sql.Stmt db *sql.DB store store.Store[event.Event]
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 13.3K bytes - Viewed (0) -
internal/event/target/mqtt.go
} if m.QoS == 0 { return errors.New("qos should be set to 1 or 2 if queueDir is set") } } return nil } // MQTTTarget - MQTT target. type MQTTTarget struct { initOnce once.Init id event.TargetID args MQTTArgs client mqtt.Client store store.Store[event.Event] quitCh chan struct{} loggerOnce logger.LogOnce }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Sep 06 23:06:30 UTC 2024 - 8.2K bytes - Viewed (0) -
cmd/data-usage_test.go
return } sizeS.totalSize = s.Size() sizeS.versions++ return sizeS, nil } return } xls := xlStorage{drivePath: base, diskInfoCache: cachevalue.New[DiskInfo]()} xls.diskInfoCache.InitOnce(time.Second, cachevalue.Opts{}, func(ctx context.Context) (DiskInfo, error) { return DiskInfo{Total: 1 << 40, Free: 1 << 40}, nil }) weSleep := func() bool { return false }
Registered: Sun Nov 03 19:28:11 UTC 2024 - Last Modified: Fri Oct 04 22:23:33 UTC 2024 - 14.7K bytes - Viewed (0)