Fix a race condition between pools.get and pools.set