Skip to content

Conversation

@marjune163
Copy link
Collaborator

No description provided.

@marjune163 marjune163 force-pushed the unstable-max-ar-workers branch 3 times, most recently from 5da4ee0 to 70603f3 Compare April 26, 2025 09:33
@marjune163 marjune163 force-pushed the unstable-max-ar-workers branch 2 times, most recently from caab098 to 363886f Compare April 26, 2025 10:39
@marjune163 marjune163 force-pushed the unstable-max-ar-workers branch from 363886f to 85be435 Compare April 26, 2025 12:25
Introduce a new `archiveWorkers` channel to limit the number of concurrent archive operations. When the limit is reached, new requests will receive a 429 Too Many Requests response. This prevents resource exhaustion and improves system stability. The maximum number of workers can be configured via the `--max-archive-workers` CLI option.
@marjune163 marjune163 force-pushed the unstable-max-ar-workers branch 2 times, most recently from 5e464f5 to 4320eac Compare April 26, 2025 14:14
@marjune163 marjune163 force-pushed the unstable-max-ar-workers branch from 4320eac to 63dedd2 Compare April 28, 2025 15:13
} else {
data.Status = http.StatusTooManyRequests
}
atomic.AddUint32(h.archivingWorkers, ^uint32(0)) // archiveWorkers -= 1
Copy link

@OlegChuev OlegChuev May 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can ^uint32(0) cause uint underflow? (0 - 1 -> 4294967295)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think in this case, this would never happened since it always added by 1 first.

@marjune163
Copy link
Collaborator Author

marjune163 commented May 7, 2025

@OlegChuev as this project is claimed and designed as stateless(https://github.com/mjpclab/go-http-file-server/blob/main/README.md#tech-features), stateful variable(here archivingWorkers) should not exists in server scope(although there may be some temporary state for each request scope). So I would rather not merge this change to main branch.

@marjune163 marjune163 force-pushed the unstable branch 9 times, most recently from 55a64ae to b52e441 Compare June 2, 2025 04:01
@marjune163 marjune163 force-pushed the unstable branch 7 times, most recently from 972ddfb to caea005 Compare August 31, 2025 15:17
@marjune163 marjune163 force-pushed the unstable branch 5 times, most recently from 805d411 to 5c9954d Compare September 11, 2025 15:12
@marjune163 marjune163 force-pushed the unstable branch 4 times, most recently from 361e668 to fc641cb Compare September 14, 2025 07:27
@marjune163 marjune163 force-pushed the unstable branch 13 times, most recently from 53af32f to c0b359a Compare October 1, 2025 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants