Skip to content

Commit

Permalink
Merge pull request #438 from rbino/push-properties-always-ok
Browse files Browse the repository at this point in the history
appengine_api: always consider push to properties interfaces succesful
  • Loading branch information
bettio authored Jul 10, 2020
2 parents 90f40cc + 775c1fa commit d1abf31
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Fixed
- [astarte_appengine_api] Fix regression that made it impossible to use Astarte Channels.
- [astarte_appengine_api] Fix bug that prevented data publishing in object aggregated interfaces.
- [astarte_appengine_api] Fix regression that prevented properties to be set before the first
connection of a device.

### Added
- [astarte_housekeeping] Allow deleting a realm. The feature can be enabled with an environment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,11 +646,20 @@ defmodule Astarte.AppEngine.API.Device do
# We use get since we can be in a properties case
reliability = Keyword.get(opts, :reliability)

if type == :datastream and reliability == :unreliable do
# Unreliable datastream is the only case where this is ok
:ok
else
{:error, :cannot_push_to_device}
cond do
type == :properties ->
# No matches will happen only if the device doesn't have a session on
# the broker, but the SDK would then send an emptyCache at the first
# connection and receive all properties. Hence, we return :ok for
# properties even if there are no matches
:ok

type == :datastream and reliability == :unreliable ->
# Unreliable datastream is allowed to fail
:ok

true ->
{:error, :cannot_push_to_device}
end
end

Expand Down

0 comments on commit d1abf31

Please sign in to comment.