fix: fixed app restart after uploading file from ()dl usage

This commit is contained in:
lyx0 2023-10-03 18:43:43 +02:00
parent 5363eb45cc
commit 68f5cbbb9e
2 changed files with 7 additions and 7 deletions

View file

@ -118,11 +118,6 @@ func main() {
"err", err,
)
}
sugar.Infow("db.Stats",
"db.Stats", db.Stats(),
)
app := &application{
TwitchClient: tc,
HelixClient: helixClient,
@ -132,6 +127,10 @@ func main() {
Scheduler: cron.New(),
}
app.Log.Infow("db.Stats",
"db.Stats", db.Stats(),
)
// Received a PrivateMessage (normal chat message).
app.TwitchClient.OnPrivateMessage(func(message twitch.PrivateMessage) {
// sugar.Infow("New Twitch PrivateMessage",
@ -194,6 +193,7 @@ func main() {
if err != nil {
panic(err)
}
}
// openDB returns the sql.DB connection pool.

View file

@ -26,7 +26,7 @@ func Download(target, link string, tc *twitch.Client, log *zap.SugaredLogger) (r
twitchClient: tc,
}
dloader.dlxd(target, link)
go dloader.dlxd(target, link)
return ""
}
@ -113,7 +113,7 @@ func (dl *downloader) upload(target, path string) {
}
req.Header.Set("Content-Type", form.FormDataContentType())
httpClient := http.Client{}
httpClient := http.DefaultClient
resp, err := httpClient.Do(req)
if err != nil {
dl.twitchClient.Say(target, fmt.Sprintf("Something went wrong FeelsBadMan: %q", err))