sync container metadata before operations#1595
Conversation
|
@crosbymichael In most cases, we only need to read the information in |
|
@Random-Liu SGTM, i'll update |
dff00c7 to
817f679
Compare
|
Updated with an RW mutex |
Codecov Report
@@ Coverage Diff @@
## master #1595 +/- ##
=======================================
Coverage 46.29% 46.29%
=======================================
Files 24 24
Lines 3378 3378
=======================================
Hits 1564 1564
Misses 1456 1456
Partials 358 358Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Seems like a write lock is needed. Although I don't think we need to update container here. :)
There was a problem hiding this comment.
i don't want this to be called twice since you can only have 1 task per container
817f679 to
6a53956
Compare
mlaventure
left a comment
There was a problem hiding this comment.
Labels, Spec and Extensions can be updated by the user. In the case of the Labels we do retrieve the container again before returning them. For consistency, we should probably do the same for Spec and Extensions.
Otherwise, we could add a Refresh method and just returned the currently store values for them.
The first choice is more resilient to change by different clients though.
There was a problem hiding this comment.
We should probably update the container here, same as labels below since those can be changed.
There was a problem hiding this comment.
we will have to update these to return an error, do you think that is ok?
There was a problem hiding this comment.
It's what we have for Labels. And probably what we should have for Specs since it can be updated too. Would make it consistent
There was a problem hiding this comment.
I don't see this id being used anywhere
This makes sure the client is always in sync with the server before performing any type of operations on the container metadata. Signed-off-by: Michael Crosby <[email protected]>
6a53956 to
fa9e9bd
Compare
|
Ok, I updated this and remove the lock all together and fetch the current data from the server before performing or returning anything. This makes sure that the client is never stale and does not store the container metadata locally. |
|
This looks even better. Thanks |
|
LGTM |
Fix unix lint
This makes sure the client is always in sync with the server before
performing any type of operations on the container metadata.
Signed-off-by: Michael Crosby [email protected]