Skip to content

Commit

Permalink
🐛 fix sync delay issue
Browse files Browse the repository at this point in the history
  • Loading branch information
theapache64 committed Apr 2, 2021
1 parent 1743c8b commit d64de43
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group 'com.github.theapache64'
version '0.0.6'
version '0.0.7'

repositories {
jcenter()
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/com/github/theapache64/gpa/api/Play.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.github.theapache64.gpa.core.SearchEngineResultPage
import com.github.theapache64.gpa.model.Account
import kotlinx.coroutines.CoroutineDispatcher
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext

object Play {
Expand All @@ -19,6 +20,7 @@ object Play {
password: String,
locale: String = PlayUtils.getLocalization(),
dispatcher: CoroutineDispatcher = Dispatchers.IO,
loginDelay: Long = 10_000,
): Account = withContext(dispatcher) {

// Building GooglePlayAPI
Expand All @@ -41,6 +43,9 @@ object Play {
// Upload device config
api.uploadDeviceConfig()

// giving time to sync the device config in google servers.
delay(loginDelay)

Account(
username,
password,
Expand Down
3 changes: 0 additions & 3 deletions src/test/kotlin/com/github/theapache64/gpa/api/PlayTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import com.akdeniz.googleplaycrawler.GooglePlayAPI
import com.akdeniz.googleplaycrawler.GooglePlayException
import com.github.theapache64.gpa.utils.runBlockingTest
import com.theapache64.expekt.should
import kotlinx.coroutines.delay
import org.apache.http.client.ClientProtocolException
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Test
Expand All @@ -28,8 +27,6 @@ internal class PlayTest {
// val account = testAccount
account.should.not.`null`
api = Play.getApi(account)
println("Waiting for 30 seconds...")
delay(10000) // wait to sync the id in google's blood
}

@Test
Expand Down

0 comments on commit d64de43

Please sign in to comment.