-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
refresh buffer during cron action #59
refresh buffer during cron action #59
Conversation
Hi @LoisRForgeFlow, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Makes sense
/ocabot merge patch |
Hey, thanks for contributing! Proceeding to merge this for you. |
@JordiBForgeFlow your merge command was aborted due to failed check(s), which you can inspect on this commit of 13.0-ocabot-merge-pr-59-by-JordiBForgeFlow-bump-patch. After fixing the problem, you can re-issue a merge command. Please refrain from merging manually as it will most probably make the target branch red. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it needed? is this solving any bug?
self.refresh() | ||
if not only_nfp or only_nfp == "out": | ||
self._calc_qualified_demand() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is also used for the nfp calculation, with the refresh in that position it will always be executed, even when you only want to update NFP.
@@ -1218,6 +1218,7 @@ def cron_actions(self, only_nfp=False): | |||
"""This method is meant to be inherited by other modules in order to | |||
enhance extensibility.""" | |||
self.ensure_one() | |||
self.refresh() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@api.model
def refresh(self):
""" Clear the records cache.
.. deprecated:: 8.0
The record cache is automatically invalidated.
"""
self.invalidate_cache()
The correct method is: self.invalidate_cache()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And actually it looks like a dangerous call, because it wipes all the cache for the stock buffers, I suppose it should be at least self.invalidate_cache(ids=self.ids)
, but probably fnames
should be set as well so only the desired computed fields are invalidated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried something like this:
def cron_actions(self, only_nfp=False):
"""This method is meant to be inherited by other modules in order to
enhance extensibility."""
self.ensure_one()
# invalidate all non-stored computed values
self.invalidate_cache(
fnames=[
fieldname
for fieldname, props in self._fields.items()
if props.compute
and not props.store
and not props.relational
and not props.related
],
ids=self.ids,
)
if not only_nfp or only_nfp == "out":
But even then, it recomputes probably too much, for each buffer of the chunks.
@@ -1218,6 +1218,7 @@ def cron_actions(self, only_nfp=False): | |||
"""This method is meant to be inherited by other modules in order to | |||
enhance extensibility.""" | |||
self.ensure_one() | |||
self.refresh() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And actually it looks like a dangerous call, because it wipes all the cache for the stock buffers, I suppose it should be at least self.invalidate_cache(ids=self.ids)
, but probably fnames
should be set as well so only the desired computed fields are invalidated.
Same question :) |
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
I think we can close this in favor of the fixes included in #81. @JordiBForgeFlow If we miss something please reopen it. |
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA/ddmrp#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA/ddmrp#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA/ddmrp#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA/ddmrp#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
Fix tests: * test_22_procure_recommended * test_23_buffer_zones_all It is possible that the invalidation is only required because of the tests and would not be required at runtime. But this has been proposed in the past: OCA#59 However, this commit tries to invalidate the less possible fields to limit the computations and data to fetch again.
No description provided.