fix: properly recycle request id (#920)

add-signin-page
Meng Zhang 2023-11-30 17:01:52 +08:00 committed by GitHub
parent 30d2ba5f00
commit 8d1303d6e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -38,7 +38,10 @@ impl LlamaServiceImpl {
fn alloc_request_id(&mut self) -> u32 {
let ret = self.next_request_id;
self.next_request_id += 1;
// 1048576 (2^20) should be large enough to avoid any collision.
// FIXME(meng): figure out a better way.
self.next_request_id = (self.next_request_id + 1) % 1048576;
ret
}