delaying working dir creation to when its needed, lazy is sychronised by default

This commit is contained in:
Adam Brown 2021-10-27 17:54:42 +01:00
parent 8d668cc118
commit c2ce10f89c
1 changed files with 3 additions and 2 deletions

View File

@ -39,8 +39,9 @@ internal class RoomSyncEphemeralTemporaryStoreFile @Inject constructor(
moshi: Moshi
) : RoomSyncEphemeralTemporaryStore {
private val workingDir = File(fileDirectory, "rr")
.also { it.mkdirs() }
private val workingDir: File by lazy {
File(fileDirectory, "rr").also { it.mkdirs() }
}
private val roomSyncEphemeralAdapter = moshi.adapter(RoomSyncEphemeral::class.java)