Skip to content
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

Feature/poll smdpplus for install and download statuses #971

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from

Conversation

la3lma
Copy link
Member

@la3lma la3lma commented Nov 29, 2019

We have experienced instabilities in the ES2+ callbacks. This is a patch that introduces a dropwizard task, intended to be triggered by a cronjob, that will poll the SM-DP+ via ES2+ to determine the state of the profiles that has been reserved for download, but have not yet been registered in the sim manager database as downloaded (as seen by the SM-DP+).

…here the new functionality would apply, so it still needs to be amended a bit.
…tually tests the functionality of the poller.
…ities, in preparation of removing them where they are duplicated.
val statuses = profileVendorAdapter.getProfileStatusList(iccidList)
statuses.mapRight{
it.forEach { updateProfileInDb(it) } }
} // TODO: Am I missing the error situation here?
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should maybe log errors I think. Something like...

pvaf.getAdapterByVendorId(vendorId)
     .flatMap { profileVendorAdapter ->
           profileVendorAdapter.getProfileStatusList(iccidList)
               .flatMap {
                    it.forEach ...
              }
        }
       .mapLeft {
             log errors
      }

or something...

val state = SmDpPlusState.valueOf(stateString.toUpperCase())

if (state != SmDpPlusState.RELEASED) {
val update = simInventoryDAO.setSmDpPlusStateUsingIccid(iccid, state)
Copy link
Collaborator

Choose a reason for hiding this comment

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

simInventoryDAO.setSmDpPlusStateUsingIccid(iccid, state)
    .flatMap {
            val report = "Updated  state for iccid=$iccid to ${state.name}"
             logger.info(report)
             reportln(report)
            it
      }
      .mapLeft {
            reportln("Could not update  iccid=$iccid still set to ${state.name}.  ...")
     }

Or maybe better, use fold as the function don't return anything.

}

fun updateProfileInDb(p: ProfileStatus) {
try {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should not be needed as the called functions returns an Either.

Copy link
Member Author

Choose a reason for hiding this comment

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

don't understand that comment. Please elaborate.

Copy link
Collaborator

@kmmatwork kmmatwork left a comment

Choose a reason for hiding this comment

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

OK by me. Some nitpicking here and there.
Would also like to see more use of Arrow (Either etc.).
Have not gone through the whole "poll" code as such, just this changeset.

@la3lma
Copy link
Member Author

la3lma commented Dec 10, 2019

Thank you Kjell. I will incorporate your suggestions and merge only after I have done so.

…' of github.com:ostelco/ostelco-core into feature/poll-smdpplus-for-install-and-download-statuses
@cyriaquebrousse cyriaquebrousse removed their request for review July 10, 2020 11:47
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.

2 participants