Functions returning collections of resources fail for resources created with this GolemNode instance
Opened this issue · 0 comments
johny-b commented
This doesn't work:
async with GolemNode() as golem:
allocation = await golem.create_allocation(1)
allocations = await golem.allocations()
(NOTE: The same happens for any other resource that has a corresponding collection-returning method, e.g. demand
or invoice
).
There is a straightforward fix available - just remove a single assert
- but I'm not sure what is the best solution. There are 3 options:
A) Some allocations returned from GolemNode.allocations()
might have out of date .data
B) GolemNode.allocations()
updates .data
for all already created Allocation
objects
C) We have more than one Allocation
object with the same id
I'm pretty sure we should avoid C.
Straightforward "just remove assert" is A. I think B might be slightly better. Important: should we emit ResourceDataChanged
event? I'd say yes, although I'm not super-sure.