[AI assisted] MM-63304: Wrap around dqPtr while unmarshalling (#30371)

If the deadQueue was full, we would be incorrectly sending
the wrong index for dqPtr. Fixed that and added a test case.

https://mattermost.atlassian.net/browse/MM-63304

```release-note
NONE
```
Этот коммит содержится в:
Agniva De Sarker
2025-03-04 13:36:04 +05:30
коммит произвёл GitHub
родитель 7e9cff04c7
Коммит a5d318cdfb
3 изменённых файлов: 56 добавлений и 3 удалений

Просмотреть файл

@@ -156,7 +156,7 @@ func (ps *PlatformService) UnmarshalDQ(buf []json.RawMessage) ([]*model.WebSocke
// Same as active queue, this can never be out of bounds because all dead queues
// are of deadQueueSize.
dq[dqPtr] = item
dqPtr++
dqPtr = (dqPtr + 1) % deadQueueSize
}
return dq, dqPtr, nil
}