Skip to content

Fix concurrent modification error in AuctionMark #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -746,8 +746,8 @@ public void updateItemQueues() {
continue;
}

for (ItemInfo itemInfo : items) {
this.addItemToProperQueue(itemInfo, currentTime);
for (Iterator<ItemInfo> it = items.iterator(); it.hasNext();) {
this.addItemToProperQueue(it.next(), currentTime, it);
}
}

Expand All @@ -767,10 +767,10 @@ public ItemStatus addItemToProperQueue(ItemInfo itemInfo, boolean is_loader) {
Timestamp baseTime = (is_loader ? this.getLoaderStartTime() : this.getCurrentTime());


return addItemToProperQueue(itemInfo, baseTime);
return addItemToProperQueue(itemInfo, baseTime, null);
}

private ItemStatus addItemToProperQueue(ItemInfo itemInfo, Timestamp baseTime) {
private ItemStatus addItemToProperQueue(ItemInfo itemInfo, Timestamp baseTime, Iterator<ItemInfo> currentQueueIterator) {
// Always check whether we even want it for this client
// The loader's profile and the cache profile will always have a negative client_id,
// which means that we always want to keep it
Expand Down Expand Up @@ -799,30 +799,25 @@ private ItemStatus addItemToProperQueue(ItemInfo itemInfo, Timestamp baseTime) {


if (!new_status.equals(existingStatus)) {
// Remove the item from the current queue
if (currentQueueIterator != null) {
currentQueueIterator.remove();
}

switch (new_status) {
case OPEN:
this.addItem(this.items_available, itemInfo);
break;
case ENDING_SOON:
this.items_available.remove(itemInfo);
this.addItem(this.items_endingSoon, itemInfo);
break;
case WAITING_FOR_PURCHASE:
(existingStatus == ItemStatus.OPEN ? this.items_available : this.items_endingSoon).remove(itemInfo);
this.addItem(this.items_waitingForPurchase, itemInfo);
break;
case CLOSED:
if (existingStatus == ItemStatus.OPEN) {
this.items_available.remove(itemInfo);
} else if (existingStatus == ItemStatus.ENDING_SOON) {
this.items_endingSoon.remove(itemInfo);
} else {
this.items_waitingForPurchase.remove(itemInfo);
}
this.addItem(this.items_completed, itemInfo);
break;
default:

}
itemInfo.setStatus(new_status);
}
Expand Down