Skip to content
This repository has been archived by the owner on Nov 23, 2023. It is now read-only.

Refactor zuora service implementation #653

Merged
merged 4 commits into from Aug 4, 2015

Conversation

afiore
Copy link
Contributor

@afiore afiore commented Jul 30, 2015

The current implementation of ZuoraService initialises a number of ScheduledTasks with a "blank" authentication value. This is not ideal, as it means that for a small time window, the application is not capable to talk to Zuora. In this specific case ScheduledTask also makes composing async operations in the right order harder than necessary, forcing us to use fiddly callbacks to ensure that operations happen in the right order.

Following a suggestion from @rtyley, I have repurposed a pattern from Prout. This consists in wrapping a future value into an Akka agent, which in turn gets periodically refreshed by the Actor system's scheduler (see utils.FutureSupplier).

Note: This PR branches off #647

@tudorraul @rtyley

refreshAlteringFuture <- agent.alter { currentRefresh =>
if (currentRefresh.isCompleted) f else currentRefresh
}
refreshFuture <- refreshAlteringFuture
Copy link
Contributor

Choose a reason for hiding this comment

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

misleading name here I think; the type of refreshFuture is not Future[T]

@tudorraul
Copy link
Contributor

👍 bar the comment

afiore pushed a commit that referenced this pull request Aug 4, 2015
Refactor zuora service implementation
@afiore afiore merged commit 37bbef6 into books-or-events-choice Aug 4, 2015
@afiore afiore deleted the simplify-zuora-service branch August 4, 2015 11:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants