getProfile synchronized
This commit is contained in:
parent
d0365afe89
commit
e06ec0eba1
|
@ -67,14 +67,15 @@ class ProfileFunctionImplementation @Inject constructor(
|
|||
override fun getProfile(): Profile? =
|
||||
getProfile(dateUtil.now())
|
||||
|
||||
@Synchronized
|
||||
override fun getProfile(time: Long): Profile? {
|
||||
val rounded = time - time % 1000
|
||||
val cached = cache[rounded]
|
||||
if (cached != null) {
|
||||
// aapsLogger.debug("XXXXXXXXXXXXXXX HIT getProfile for $time $rounded")
|
||||
// aapsLogger.debug("HIT getProfile for $time $rounded")
|
||||
return cached
|
||||
}
|
||||
// aapsLogger.debug("XXXXXXXXXXXXXXX getProfile called for $time")
|
||||
// aapsLogger.debug("getProfile called for $time")
|
||||
val ps = repository.getEffectiveProfileSwitchActiveAt(time).blockingGet()
|
||||
if (ps is ValueWrapper.Existing) {
|
||||
val sealed = ProfileSealed.EPS(ps.value)
|
||||
|
|
Loading…
Reference in a new issue