Bug #11330
closed
Inventory endpoint info api is reporting saturated off by one
Added by Janos Mattyasovszky about 7 years ago.
Updated about 7 years ago.
Category:
Web - Nodes & inventories
Severity:
Minor - inconvenience | misleading | easy workaround
User visibility:
Operational - other Techniques | Technique editor | Rudder settings
Effort required:
Very Small
Description
I got this back from the API endpoint while testing the inventory uploader:
{"queueMaxSize":50, "queueFillCount":49, "queueSaturated":true}
I have tested on: rudder-inventory-endpoint-4.1.5.release-1.SLES.11
- Related to User story #9976: API endpoint to get information about queue status of uploaded inventories added
In #9976 the example shows saturated when both are equal:
{
"queueMaxSize": 200,
"queueFillCount": 200,
"queueSaturated": true
}
There is something bogus here :)
The code is:
lazy val queueSize = AtomicInt(0)
....
def queueInfo() {
...
val current = queueSize.get
val saturated = (current+1) >= maxQueueSize
val code = if(saturated) HttpStatus.TOO_MANY_REQUESTS else HttpStatus.OK
...
}
...
// see if you can add a file
val canDo = synchronized {
if(queueSize.incrementAndGet(1) <= maxQueueSize) {
// the decrement will be done by the report processor
true
} else {
....
So for maxQueue = 50, in info, current queue = 49, +1 = 50 >= 50 => "saturated".
In canDo, current = 49, incrementAndGet(1) = 50 <= 50 => true
- Category set to Web - Nodes & inventories
- Assignee set to François ARMAND
- Target version set to 4.1.8
- User visibility changed from Infrequent - complex configurations | third party integrations to Operational - other Techniques | Technique editor | Rudder settings
- Effort required set to Very Small
- Priority changed from 22 to 49
- Status changed from New to In progress
- Status changed from In progress to Pending technical review
- Assignee changed from François ARMAND to Nicolas CHARLES
- Pull Request set to https://github.com/Normation/ldap-inventory/pull/119
- Status changed from Pending technical review to Pending release
- Target version changed from 4.1.8 to 4.1.7
- Status changed from Pending release to Released
This bug has been fixed in Rudder 4.1.7 and 4.2.0~rc1 which were released today.
Also available in: Atom
PDF