From c2ce10f89c94f33225c6a88f0d0bca593dd2edbe Mon Sep 17 00:00:00 2001 From: Adam Brown Date: Wed, 27 Oct 2021 17:54:42 +0100 Subject: [PATCH] delaying working dir creation to when its needed, lazy is sychronised by default --- .../internal/session/sync/RoomSyncEphemeralTemporaryStore.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt index e8f74bbd48..c95c3bff91 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/sync/RoomSyncEphemeralTemporaryStore.kt @@ -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)