-
Notifications
You must be signed in to change notification settings - Fork 15
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
base: develop
Are you sure you want to change the base?
Feature/poll smdpplus for install and download statuses #971
Conversation
…lus-for-install-and-download-statuses
…lus-for-install-and-download-statuses
…ting anything though.
…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.
…tionFixture for greater conciseness
sim-administration/es2plus4dropwizard/src/main/kotlin/org/ostelco/sim/es2plus/Es2PlusClient.kt
Show resolved
Hide resolved
sim-administration/es2plus4dropwizard/src/main/kotlin/org/ostelco/sim/es2plus/Es2PlusClient.kt
Show resolved
Hide resolved
...n/simmanager/src/integration-test/kotlin/org/ostelco/simcards/admin/SimAdministrationTest.kt
Show resolved
Hide resolved
val statuses = profileVendorAdapter.getProfileStatusList(iccidList) | ||
statuses.mapRight{ | ||
it.forEach { updateProfileInDb(it) } } | ||
} // TODO: Am I missing the error situation here? |
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.
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) |
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.
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 { |
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.
Should not be needed as the called functions returns an Either.
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.
don't understand that comment. Please elaborate.
...tration/simmanager/src/main/kotlin/org/ostelco/simcards/admin/PollOutstandingProfilesTask.kt
Outdated
Show resolved
Hide resolved
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.
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.
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
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+).