Skip to content

Commit 910fdc8

Browse files
committed
Remove unused cleanABTest
1 parent ae8dee0 commit 910fdc8

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

src/commonTest/kotlin/suite/Extensions.kt

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import com.algolia.search.model.response.ResponseVariant
1212
import com.algolia.search.serialize.JsonDebug
1313
import dayInMillis
1414
import io.ktor.client.features.ResponseException
15-
import io.ktor.http.HttpStatusCode
1615
import kotlinx.serialization.KSerializer
1716
import loadScratch
1817
import shouldEqual
@@ -33,33 +32,6 @@ internal fun compareVariant(actual: ResponseVariant, expected: Variant) {
3332
}
3433
}
3534

36-
internal suspend fun cleanABTest(clientSearch: ClientSearch, suffix: String, now: Boolean = false) {
37-
val regex = Regex("kotlin-(.*)-$username-$suffix")
38-
39-
clientAnalytics.browseAllABTests(hitsPerPage = 100).forEach {
40-
it.abTests.forEach { abTest ->
41-
val result = regex.find(abTest.variantA.indexName.raw)
42-
val date = result?.groupValues?.get(1)
43-
44-
if (date != null) {
45-
val difference = Time.getCurrentTimeMillis() - DateFormat.parse(date)
46-
47-
if (difference >= dayInMillis || now) {
48-
try {
49-
val deletion = clientAnalytics.deleteABTest(abTest.abTestID)
50-
51-
clientSearch.initIndex(deletion.indexName).apply {
52-
deletion.wait()
53-
}
54-
} catch (exception : ResponseException) {
55-
println(exception.readContent())
56-
}
57-
}
58-
}
59-
}
60-
}
61-
}
62-
6335
internal suspend fun cleanIndex(client: ClientSearch, suffix: String, now: Boolean = false) {
6436
client.listIndices().items.forEach {
6537
val indexName = it.indexName.raw

0 commit comments

Comments
 (0)