Skip to content

Commit 17560ef

Browse files
authored
Merge pull request #56 from scribd/nitin/APT-11103-Synchronize-Cache-Clean
[APT-11103] Make clearCache synchronous and update lib
2 parents bd0ffb2 + d9a4b4f commit 17560ef

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Armadillo/src/main/java/com/scribd/armadillo/ArmadilloPlayerChoreographer.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ import io.reactivex.disposables.CompositeDisposable
4646
import io.reactivex.disposables.Disposable
4747
import io.reactivex.subjects.BehaviorSubject
4848
import java.util.concurrent.TimeUnit
49+
import java.util.concurrent.locks.ReentrantLock
4950
import javax.inject.Inject
51+
import kotlin.concurrent.withLock
5052

5153
/**
5254
* The client will use [ArmadilloPlayer] to communicate with the [ArmadilloPlayerChoreographer].
@@ -248,6 +250,8 @@ internal class ArmadilloPlayerChoreographer : ArmadilloPlayer {
248250

249251
private var isDownloadEngineInit = false
250252

253+
private val cacheLock = ReentrantLock()
254+
251255
/**
252256
* Used to delegates all actions to the player. ex. [MediaControllerCompat.TransportControls.play]
253257
*/
@@ -282,7 +286,9 @@ internal class ArmadilloPlayerChoreographer : ArmadilloPlayer {
282286
}
283287

284288
override fun clearCache() = runHandler {
285-
cacheManager.clearPlaybackCache()
289+
cacheLock.withLock {
290+
cacheManager.clearPlaybackCache()
291+
}
286292
}
287293

288294
override fun removeAllDownloads() = runHandler {

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ org.gradle.jvmargs=-Xmx1536m
1313
# org.gradle.parallel=true
1414
PACKAGE_NAME=com.scribd.armadillo
1515
GRADLE_PLUGIN_VERSION=7.2.0
16-
LIBRARY_VERSION=1.7.0
16+
LIBRARY_VERSION=1.7.1
1717
EXOPLAYER_VERSION=2.19.1
1818
RXJAVA_VERSION=2.2.4
1919
RXANDROID_VERSION=2.0.1

0 commit comments

Comments
 (0)