Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: smoother compression and retries (fixes #5037) #5038

Merged
merged 6 commits into from
Jan 17, 2025

Conversation

Okuro3499
Copy link
Collaborator

fixes #5037
this pr implements

  1. GZIP which is a file compression and decompression format that reduces the size of data transferred between clients and servers
  2. Exponential Backoff which involves retrying a failed operation with increasing delays between attempts, typically doubling the wait time after each failure

@Okuro3499 Okuro3499 changed the title sync: improve sync time (fixes #5037) sync: compress data with retries (fixes #5037) Jan 15, 2025
@dogi dogi requested review from deeppp15 and pavi38 January 16, 2025 19:26
@dogi dogi changed the title sync: compress data with retries (fixes #5037) sync: smoother data compression with retries (fixes #5037) Jan 16, 2025
@deeppp15
Copy link
Member

Hi @Okuro3499

I am getting this Exception in the logcat

java.lang.IllegalStateException: cannot make a new request because the previous response is still open: please call response.close()
2025-01-16 15:32:27.761 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.connection.Transmitter.newExchange(Transmitter.java:164)
2025-01-16 15:32:27.761 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:41)
2025-01-16 15:32:27.761 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2025-01-16 15:32:27.761 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
2025-01-16 15:32:27.761 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:94)
2025-01-16 15:32:27.761 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2025-01-16 15:32:27.761 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:88)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at org.ole.planet.myplanet.datamanager.ApiClient$RetryInterceptor.intercept(ApiClient.kt:52)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at org.ole.planet.myplanet.datamanager.ApiClient.get_client$lambda$0(ApiClient.kt:24)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at org.ole.planet.myplanet.datamanager.ApiClient.$r8$lambda$rl8mq1NyziqOiNWogs9t7qMones(Unknown Source:0)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at org.ole.planet.myplanet.datamanager.ApiClient$$ExternalSyntheticLambda0.intercept(D8$$SyntheticClass:0)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:142)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:117)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:229)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at okhttp3.RealCall.execute(RealCall.java:81)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at retrofit2.OkHttpCall.execute(OkHttpCall.java:207)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at retrofit2.DefaultCallAdapterFactory$ExecutorCallbackCall.execute(DefaultCallAdapterFactory.java:108)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at org.ole.planet.myplanet.service.UploadManager.uploadNews$lambda$16(UploadManager.kt:474)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at org.ole.planet.myplanet.service.UploadManager.$r8$lambda$XowlY3_sYQ2s9xbldOwTEMtOODE(Unknown Source:0)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at org.ole.planet.myplanet.service.UploadManager$$ExternalSyntheticLambda20.execute(D8$$SyntheticClass:0)
2025-01-16 15:32:27.762 22096-22228 System.err org.ole.planet.myplanet W at io.realm.Realm$1.run(Realm.java:1745)
2025-01-16 15:32:27.763 22096-22228 System.err org.ole.planet.myplanet W at io.realm.internal.async.BgPriorityRunnable.run(BgPriorityRunnable.java:34)
2025-01-16 15:32:27.763 22096-22228 System.err org.ole.planet.myplanet W at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:458)
2025-01-16 15:32:27.763 22096-22228 System.err org.ole.planet.myplanet W at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2025-01-16 15:32:27.763 22096-22228 System.err org.ole.planet.myplanet W at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
2025-01-16 15:32:27.763 22096-22228 System.err org.ole.planet.myplanet W at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
2025-01-16 15:32:27.763 22096-22228 System.err org.ole.planet.myplanet W at java.lang.Thread.run(Thread.java:764)

Copy link
Member

@deeppp15 deeppp15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

calling respone.close() before making new requests in the Retry calls

@dogi dogi changed the title sync: smoother data compression with retries (fixes #5037) sync: smoother compression with retries (fixes #5037) Jan 17, 2025
@dogi dogi changed the title sync: smoother compression with retries (fixes #5037) sync: smoother compression and retries (fixes #5037) Jan 17, 2025
@dogi dogi merged commit 5da6cd1 into master Jan 17, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sync improvement 1
4 participants