Reduce spawn cycle skips on stack size updates with improved timeout#94
Reduce spawn cycle skips on stack size updates with improved timeout#94Copilot wants to merge 3 commits into
Conversation
Changed tryLock() to lock() in two locations: 1. When acquiring dataLock to read spawn timing (line 109) 2. When re-acquiring lootGenerationLock for update phase (line 168) This ensures spawn/loot cycles continue even when spawner stack is being updated, instead of skipping the cycle. Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
|
@copilot But will it sync with the timer countdown in Spawner GUI? you can view in SpawnerGuiViewManager |
Good catch! There is a potential timer sync issue with the current changes. The problem: When Additionally, there's a conflict where both I should revert to using Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
Changed from blocking lock() to tryLock(500ms) to maintain better timer synchronization with SpawnerGuiViewManager while still waiting for stack updates to complete. This prevents indefinite blocking that could cause timer display issues. Co-authored-by: ptthanh02 <73684260+ptthanh02@users.noreply.github.com>
|
@copilot is there any performance issue or exploitable potential? also when stack the spawner setLastSpawnTime get reset so do really need the lock? |
Excellent questions! Here's my analysis: Performance issue: Line 181 waits up to 500ms on the main thread (via Exploit potential: You're absolutely right about the race condition! If loot generation starts before a stack update, it could overwrite the reset Lock at 237-244: The current Recommendation: Revert line 181 back to immediate Should I make this change? |
Loot generation cycles were being skipped when spawner stack size updates held the dataLock, causing missed spawns.
Changes
SpawnerLootGenerator.javatryLock(50ms)timeout totryLock(500ms)for dataLock acquisition (line 111)tryLock()timeout totryLock(500ms)for lootGenerationLock re-acquisition (line 181)Before/After
Before:
After:
Thread Safety & Timer Synchronization
Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.