diff --git a/bot.go b/bot.go index 7db24da..47b647a 100644 --- a/bot.go +++ b/bot.go @@ -133,10 +133,12 @@ func RunBot(token string) error { } if err := AddReq(reqData); err != nil { - resultsC <- result{ - req: req, - err: err, - } + go func() { + resultsC <- result{ + req: req, + err: err, + } + }() return } @@ -176,6 +178,7 @@ func RunBot(token string) error { }) } case result := <-resultsC: + L.Debug("Cleaning up the request", zap.Any("request", result.req.Data)) if err := DelReq(result.req.Data); err != nil { L.Error( "Failed to clean up request", diff --git a/docker-compose.example.yaml b/docker-compose.example.yaml new file mode 100644 index 0000000..d5957ed --- /dev/null +++ b/docker-compose.example.yaml @@ -0,0 +1,17 @@ +services: + shortique: + image: ghcr.io/hedlx/shortique:latest + restart: unless-stopped + depends_on: + - redis + environment: + - REDIS=redis:6379 + - TOKEN=%TELEGRAM_BOT_TOKEN% + redis: + image: "redis:alpine" + restart: unless-stopped + volumes: + - redis_data:/data + +volumes: + redis_data: diff --git a/docker-compose.yaml b/docker-compose.yaml index bae35a0..f9fd445 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,8 +9,10 @@ services: environment: - REDIS=redis:6379 redis: - image: "redis:6-alpine" + image: "redis:alpine" restart: unless-stopped + ports: + - "6379:6379" volumes: - redis_data:/data diff --git a/download.go b/download.go index 75670ac..e068a3e 100644 --- a/download.go +++ b/download.go @@ -80,6 +80,7 @@ func downloadInsta(in DownloadInput, waitC <-chan struct{}, doneC chan<- error) go func() { defer resp.Body.Close() <-waitC + doneC <- nil }() return resp.Body