Skip to content

Commit bf2e7a9

Browse files
author
kriptoburak
committed
fix: remove unused async lock helper
1 parent e11fe45 commit bf2e7a9

1 file changed

Lines changed: 0 additions & 23 deletions

File tree

  • x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core

x-twitter-scraper-java-core/src/main/kotlin/com/x_twitter_scraper/api/core/Utils.kt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ package com.x_twitter_scraper.api.core
55
import com.x_twitter_scraper.api.errors.XTwitterScraperInvalidDataException
66
import java.util.Collections
77
import java.util.SortedMap
8-
import java.util.concurrent.CompletableFuture
9-
import java.util.concurrent.locks.Lock
108

119
@JvmSynthetic
1210
internal fun <T : Any> T?.getOrThrow(name: String): T =
@@ -92,24 +90,3 @@ internal fun Any?.contentToString(): String {
9290
}
9391

9492
internal interface Enum
95-
96-
/**
97-
* Executes the given [action] while holding the lock, returning a [CompletableFuture] with the
98-
* result.
99-
*
100-
* @param action The asynchronous action to execute while holding the lock
101-
* @return A [CompletableFuture] that completes with the result of the action
102-
*/
103-
@JvmSynthetic
104-
internal fun <T> Lock.withLockAsync(action: () -> CompletableFuture<T>): CompletableFuture<T> {
105-
lock()
106-
val future =
107-
try {
108-
action()
109-
} catch (e: Throwable) {
110-
unlock()
111-
throw e
112-
}
113-
future.whenComplete { _, _ -> unlock() }
114-
return future
115-
}

0 commit comments

Comments
 (0)