Skip to content
This repository was archived by the owner on Dec 18, 2022. It is now read-only.

Commit 1be226a

Browse files
committed
perform a check in method initialize to only allow for variable to be set once
1 parent 5cdd2c3 commit 1be226a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

topl-service/src/main/java/io/matthewnelson/topl_service/service/components/actions/ServiceActionProcessor.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,13 @@ internal class ServiceActionProcessor(private val torService: BaseService): Serv
9090
private set
9191

9292
fun initialize(restartMilliseconds: Long, stopServiceMilliseconds: Long) {
93-
restartTorDelayTime = restartMilliseconds
94-
stopServiceDelayTime = stopServiceMilliseconds
93+
// Only initialize it once.
94+
try {
95+
BaseService.getAppContext()
96+
} catch (e: RuntimeException) {
97+
restartTorDelayTime = restartMilliseconds
98+
stopServiceDelayTime = stopServiceMilliseconds
99+
}
95100
}
96101

97102
//////////////////////////

0 commit comments

Comments
 (0)