-
Notifications
You must be signed in to change notification settings - Fork 219
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
Provide option to skip a modification in the "twin" if the value "is equal" #1524
Comments
The idea to optimise is definitely welcome. The only thing that I worry about a bit is returning a DittoRuntimeException because from a semantic point of view the modification did not fail. Technically it would be possible to simply add 304 to the HTTP status codes of a regular modification response. The response does not imply that anything was changed. TL;DR I suggest to favour a regular modification response (with status 304) over an error response. |
We already do that - do you suggest to change the existing exceptions as well? Lines 52 to 58 in 229ff8c
Lines 52 to 58 in 229ff8c
|
Then, I guess, we should stick to the established approach. (Although, I would be surprised to receive an exception for an idempotent action that actually produced the effect it was supposed to produce.) |
At the HTTP API, you will already get a HTTP 304 - with an "Error payload", but that can easily be ignored :) We can look into improving this when tackling the issue .. |
By the way, the HTTP API documentation does not state, that 304 is a possible result for modification (at least not for putting an attribute or a feature property) and thus also not the "error payload". So, formally, it would not be an API break if we changed it for HTTP as well, would it? |
For the HTTP API it probably would not be an API break - but for the DittoProtocol channels it would. edit: Maybe we could add another header which would state that "not modified" shall not be responded as exception/error, but as "success". Or we could implicitly do that for the new "equality check" header... that would be a new API functionality and therefore not a break. |
…of an equal value * default is "update" (which is the current behavior), always overwriting the value, even if it is equal to the one before * return a "*PreconditionNotModifiedException" (HTTP 304) when "skip" is provided and value is equal * work on logic is still in progress Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
…of an equal value * default is "update" (which is the current behavior), always overwriting the value, even if it is equal to the one before * return a "*PreconditionNotModifiedException" (HTTP 304) when "skip" is provided and value is equal * work on logic is still in progress Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
…of an equal value * default is "update" (which is the current behavior), always overwriting the value, even if it is equal to the one before * return a "*PreconditionNotModifiedException" (HTTP 304) when "skip" is provided and value is equal * work on logic is still in progress Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
…al" header Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
* OpenAPI * protocol * httpapi-concepts.md Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
#1524 added "if-equal" header to define whether to "skip" and update of an equal value
The default behaviour of Ditto is for each "ModifyCommand" to apply the modification and also the twin in the MongoDB.
This could be optimised:
Header name suggestion:
To consider:
if-equal: skip
would only patch provided values differing from existing ones.The text was updated successfully, but these errors were encountered: