2 Commits

Author SHA1 Message Date
6f0e883bff up 2025-08-09 19:10:16 +02:00
5fc1b55d52 update 2025-08-09 19:05:21 +02:00
2 changed files with 4 additions and 3 deletions

View File

@@ -43,16 +43,16 @@ func NewClient(serverURL string, folder string) (*Client, error) {
serverURL: baseURL,
httpClient: httpClient,
db: db,
retryQueue: make(chan shortenJob, 1000),
retryQueue: make(chan shortenJob, 100000),
stopRetry: make(chan struct{}),
}
cli.maxCacheSize = 100000 // or make this configurable
cli.maxCacheInitialLoad = 10000
cli.cacheMap, err = lru.New(cli.maxCacheSize)
if err != nil {
return nil, err
}
cli.maxCacheSize = 100000 // or make this configurable
cli.maxCacheInitialLoad = 10000
// Create buckets if not exist
err = db.Update(func(tx *bolt.Tx) error {

View File

@@ -65,6 +65,7 @@ func (c *Client) retryWorker() {
case job := <-c.retryQueue:
err := c.sendShortenJob(job)
if err != nil {
log.Panicln("got error sending shorten job to server", err)
// Re-enqueue with delay
go func(j shortenJob) {
time.Sleep(2 * time.Second)