Skip to content

Commit

Permalink
Merge pull request #28 from terratensor/develop
Browse files Browse the repository at this point in the history
Исправлена ошибка index out of range
  • Loading branch information
audetv authored Apr 9, 2024
2 parents 38fac38 + 63e47f7 commit e7beb2a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions internal/workerpool/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,17 +98,14 @@ func process(workerID int, task *Task) {

splitEntries := task.Splitter.SplitEntry(context.Background(), *e)

// всего фрагментов
count := len(splitEntries)

for n, splitEntry := range splitEntries {
// Обязательно присваиваем created дату из БД, иначе будет перезаписан 0
splitEntry.Created = dbe[0].Created

timeNow := time.Unix(time.Now().Unix(), 0)
splitEntry.UpdatedAt = &timeNow

if n+1 < count {
// пока n меньше, чем всего фрагментов в БД, обновляем, иначе создаем новые
if n < len(dbe) {
splitEntry.ID = dbe[n].ID
err = updateOldEntry(&splitEntry, store.Storage, *logger)
if err != nil {
Expand Down

0 comments on commit e7beb2a

Please sign in to comment.