Skip to content

Add support for creating and restoring data set#4

Merged
darinkrauss merged 3 commits intodevfrom
darinkrauss/data-set-support
Mar 22, 2020
Merged

Add support for creating and restoring data set#4
darinkrauss merged 3 commits intodevfrom
darinkrauss/data-set-support

Conversation

@darinkrauss
Copy link
Contributor

  • Logout when service is deleted
  • Add bundle semantic version

- Logout when service is deleted
- Add bundle semantic version
Copy link
Contributor

@rickpasetto rickpasetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks ok so far (would love to see some unit tests), but I had some questions, if you have a chance...

self.error = error
case .success(let dataSets):
if !dataSets.isEmpty {
self.dataSetId = dataSets.first?.uploadId
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm not familiar with the Tidepool API, but is it customary to only grab the first dataSet? What if there are more?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is searching for a data set that is specific to Tidepool Loop. There should only be one of them at any time. So, grabbing the first one is appropriate here. However, I will add a check and log if there is more than one.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, or a comment is fine. Thanks.

self.session = nil

DispatchQueue.global(qos: .background).async {
self.tapi.logout(session: session) { _ in }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, again, I'm not sure I'm understanding the flow here, but, why does completeDelete logout? Is this method intended to delete the data set or delete the "service"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

completeDelete is invoked when the service is being deleted to do any final clean before all of the service's settings are destroyed. A logout is appropriate in this case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

@darinkrauss
Copy link
Contributor Author

@rickpasetto The latest commit adds logging if there was more than one data set found. Would you please review?

@ps2 I added you since @nhamming is likely out for a while.

@darinkrauss darinkrauss requested review from ps2 and rickpasetto March 18, 2020 01:09
rickpasetto
rickpasetto previously approved these changes Mar 18, 2020
Copy link
Contributor

@rickpasetto rickpasetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One nit, otherwise LGTM.

case .success(let dataSets):
if !dataSets.isEmpty {
if dataSets.count > 1 {
self.log.default("Found multiple matching data sets; expected zero or one")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

definitely a [nit] : I would've expected this to be log.error...but this is fine as-is.

- Change multiple data sets log from default to error
@darinkrauss
Copy link
Contributor Author

@rickpasetto I changed the log default to error per your suggestion. Also, I accidentally re-requested your review, so if you could approve again that'd be great. Thanks!

Copy link
Contributor

@rickpasetto rickpasetto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@ps2 ps2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@darinkrauss darinkrauss merged commit e14e2c7 into dev Mar 22, 2020
@darinkrauss darinkrauss deleted the darinkrauss/data-set-support branch March 22, 2020 18:21
ps2 added a commit that referenced this pull request Apr 21, 2023
…-service

Remote PR Set #2: Introduce RemoteCommands
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants