@@ -12,7 +12,6 @@ import com.algolia.search.model.response.ResponseVariant
1212import com.algolia.search.serialize.JsonDebug
1313import dayInMillis
1414import io.ktor.client.features.ResponseException
15- import io.ktor.http.HttpStatusCode
1615import kotlinx.serialization.KSerializer
1716import loadScratch
1817import 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-
6335internal suspend fun cleanIndex (client : ClientSearch , suffix : String , now : Boolean = false) {
6436 client.listIndices().items.forEach {
6537 val indexName = it.indexName.raw
0 commit comments