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

Store encoded request to disk when using WorkManager #8269

Merged
merged 2 commits into from May 16, 2024

Conversation

tillh-stripe
Copy link
Collaborator

@tillh-stripe tillh-stripe commented Apr 15, 2024

Summary

This pull request fixes an issue with our WorkManager integration where we tried to serialize very large request objects. Now, we store these objects on disk and retrieve them in our worker via ID.

Motivation

Testing

  • Added tests
  • Modified tests
  • Manually verified

Screenshots

Before After
before screenshot after screenshot

Changelog

Copy link
Contributor

github-actions bot commented Apr 15, 2024

Diffuse output:

OLD: paymentsheet-example-release-master.apk (signature: V1, V2)
NEW: paymentsheet-example-release-pr.apk (signature: V1, V2)

          │          compressed           │          uncompressed          
          ├───────────┬───────────┬───────┼───────────┬───────────┬────────
 APK      │ old       │ new       │ diff  │ old       │ new       │ diff   
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼────────
      dex │   3.9 MiB │   3.9 MiB │ -36 B │   8.6 MiB │   8.6 MiB │ +336 B 
     arsc │   2.2 MiB │   2.2 MiB │   0 B │   2.2 MiB │   2.2 MiB │    0 B 
 manifest │     5 KiB │     5 KiB │   0 B │  25.4 KiB │  25.4 KiB │    0 B 
      res │ 910.2 KiB │ 910.2 KiB │   0 B │   1.4 MiB │   1.4 MiB │    0 B 
   native │   2.6 MiB │   2.6 MiB │   0 B │     6 MiB │     6 MiB │    0 B 
    asset │   2.9 MiB │   2.9 MiB │ -36 B │   2.9 MiB │   2.9 MiB │  -36 B 
    other │ 194.3 KiB │ 194.3 KiB │  +4 B │ 424.7 KiB │ 424.7 KiB │    0 B 
──────────┼───────────┼───────────┼───────┼───────────┼───────────┼────────
    total │  12.8 MiB │  12.8 MiB │ -68 B │  21.6 MiB │  21.6 MiB │ +300 B 

 DEX     │ old   │ new   │ diff           
─────────┼───────┼───────┼────────────────
   files │     1 │     1 │  0             
 strings │ 43105 │ 43108 │ +3 (+8 -5)     
   types │ 14780 │ 14782 │ +2 (+6 -4)     
 classes │ 12478 │ 12480 │ +2 (+3 -1)     
 methods │ 61135 │ 61141 │ +6 (+123 -117) 
  fields │ 40331 │ 40336 │ +5 (+215 -210) 

 ARSC    │ old  │ new  │ diff 
─────────┼──────┼──────┼──────
 configs │  242 │  242 │  0   
 entries │ 6031 │ 6031 │  0
APK
    compressed    │    uncompressed    │                                           
──────────┬───────┼───────────┬────────┤                                           
 size     │ diff  │ size      │ diff   │ path                                      
──────────┼───────┼───────────┼────────┼───────────────────────────────────────────
  3.9 MiB │ -36 B │   8.6 MiB │ +336 B │ ∆ classes.dex                             
  7.3 KiB │ -33 B │   7.2 KiB │  -33 B │ ∆ assets/dexopt/baseline.prof             
    877 B │  -3 B │     745 B │   -3 B │ ∆ assets/dexopt/baseline.profm            
 49.5 KiB │  +2 B │ 116.8 KiB │    0 B │ ∆ META-INF/MANIFEST.MF                    
    272 B │  +1 B │     120 B │    0 B │ ∆ META-INF/version-control-info.textproto 
 52.8 KiB │  +1 B │ 116.9 KiB │    0 B │ ∆ META-INF/CERT.SF                        
──────────┼───────┼───────────┼────────┼───────────────────────────────────────────
    4 MiB │ -68 B │   8.9 MiB │ +300 B │ (total)
DEX
STRINGS:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   43105 │ 43108 │ +3 (+8 -5) 
  
  + LT4/X;
  + LT4/Y;
  + Ld7/l;
  + StripeAnalyticsRequestV2Storage
  + [LP5/L;
  + [LT4/V;
  + [LT4/W;
  + ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:7eebfc1,r8-mode:full,version:8.3.37}
  
  - Li5/e;
  - [LP5/K;
  - [LT4/T;
  - [LT4/U;
  - ~~R8{backend:dex,compilation-mode:release,has-checksums:false,min-api:21,pg-map-id:d51e017,r8-mode:full,version:8.3.37}
  

TYPES:

   old   │ new   │ diff       
  ───────┼───────┼────────────
   14780 │ 14782 │ +2 (+6 -4) 
  
  + LT4/X;
  + LT4/Y;
  + Ld7/l;
  + [LP5/L;
  + [LT4/V;
  + [LT4/W;
  
  - Li5/e;
  - [LP5/K;
  - [LT4/T;
  - [LT4/U;
  

METHODS:

   old   │ new   │ diff           
  ───────┼───────┼────────────────
   61135 │ 61141 │ +6 (+123 -117) 
  
  + B6.d <init>(X, c, f, P, e, j)
  + E5.b <init>(a, a)
  + F5.e <init>(a)
  + G5.m <init>(a)
  + G5.r <init>(j, y, E, M, w, e, U)
  + L7.v b() → V
  + N5.c <init>(U, F, b, e)
  + N5.c c(Y)
  + O3.e K(a) → d
  + O5.w <init>(a, o0, U, k, i, w, e, F, String, i)
  + P4.a a(d) → a
  + P5.J <init>(a, int)
  + P5.J a() → E
  + P5.J b(a) → c
  + P5.J get() → Object
  + P5.K <init>(o0)
  + P5.L <clinit>()
  + P5.L <init>(t)
  + P5.L describeContents() → int
  + P5.L equals(Object) → boolean
  + P5.L hashCode() → int
  + P5.L toString() → String
  + P5.L writeToParcel(Parcel, int)
  + P5.M a(t)
  + T4.H <init>(i, I, e)
  + T4.H F(Object, Object) → Object
  + T4.H e(Object, e) → e
  + T4.I <init>(Application)
  + T4.I a(i, v) → Object
  + T4.J h(Object) → Object
  + T4.K <clinit>()
  + T4.K equals(Object) → boolean
  + T4.K hashCode() → int
  + T4.K toString() → String
  + T4.L <init>(m, b, String, String)
  + T4.M c() → Map
  + T4.M d() → String
  + T4.M e() → String
  + T4.N <clinit>()
  + T4.N <init>()
  + T4.N a() → LinkedHashMap
  + T4.N b() → LinkedHashMap
  + T4.N c() → Map
  + T4.N d() → String
  + T4.N e() → String
  + T4.O <init>(String)
  + T4.O equals(Object) → boolean
  + T4.O hashCode() → int
  + T4.O toString() → String
  + T4.P a(int, int) → long
  + T4.Q a(String) → Data
  + T4.S <clinit>()
  + T4.T <init>(HttpURLConnection)
  + T4.T c()
  + T4.T close()
  + T4.T d() → Y
  + T4.V <clinit>()
  + T4.V <init>(String, int, String)
  + T4.V valueOf(String) → V
  + T4.V values() → V[]
  + T4.W <clinit>()
  + T4.W <init>(String, int, String)
  + T4.W valueOf(String) → W
  + T4.W values() → W[]
  + T4.X a() → Map
  + T4.X b() → V
  + T4.X c() → Map
  + T4.X d() → Iterable
  + T4.X e() → boolean
  + T4.X f() → String
  + T4.X g(OutputStream)
  + T4.Y <init>(int, String, Map)
  + T4.Y a(String) → List
  + T4.Y equals(Object) → boolean
  + T4.Y hashCode() → int
  + T4.Y toString() → String
  + T4.b b() → V
  + T4.i <init>(int, String, String, String, double, m, String, Map, V, W, Iterable, String)
  + T4.i b() → V
  + T4.n <init>(V, String, Map, m, b, String, String, boolean)
  + T4.n b() → V
  + T4.x <init>(Application, U, e, I, f)
  + T4.z a(X, e) → Object
  + W4.j <init>(c)
  + X4.B a(a) → d
  + X4.B b(a, Bundle) → d
  + X4.S0 a(g, e, d, g, g, g) → S0
  + androidx.lifecycle.r0 f0(Y) → JSONObject
  + b7.c <init>(j)
  + b7.d <init>(j)
  + b7.e <init>(j, i)
  + b7.e <init>(j, i, int)
  + b7.p <init>(g, g, g, g, g, g, g, g, e, g, e, g, J, g, g, e, g, g, g, i, d)
  + com.google.android.material.datepicker.f A(a, String) → ArrayList
  + d7.i <init>(j, int)
  + d7.j <init>(i, d, d, Application)
  + d7.k <clinit>()
  + d7.l <init>(F1)
  + i5.a <init>(d, d, N2, o0, Application, i, c)
  + i5.b <clinit>()
  + i5.c <init>(E, e)
  + i5.c I(Object) → Object
  + i5.c h(Object) → Object
  + i5.d <clinit>()
  + j5.u0 <init>(Locale, c, M, r, c)
  + k.g <init>(j)
  + k.g <init>(j, int)
  + m5.h <init>(a, Bundle)
  + n5.f <init>(a)
  + n5.i <init>(c, U, M, Z, w, y, F, E, z, e)
  + n7.s <init>(g, g, g, g, g, g, g, g, g, g, J)
  + o5.e <init>(a)
  + p5.J i0(U, a, n, b, e) → Object
  + r7.b <init>(U, String)
  + s5.g <init>(a)
  + s6.W z(Y)
  + s6.c b() → V
  + t5.k <init>(a, Bundle)
  + x5.o <init>(a)
  + x5.w <init>(l, U, Z, M, w, E, F, e)
  + y5.e <init>(a)
  + y5.h <init>(b, E, M, w, U)
  + z5.h <init>(a, Bundle)
  
  - B6.d <init>(X, c, f, N, e, j)
  - E5.b <init>(b, a)
  - F5.e <init>(b)
  - G5.m <init>(b)
  - G5.r <init>(j, y, E, L, w, e, U)
  - L7.v b() → T
  - N5.c <init>(S, F, b, e)
  - N5.c c(W)
  - O3.e K(b) → d
  - O5.w <init>(b, o0, U, k,
...✂

@tillh-stripe tillh-stripe force-pushed the tillh/work-manager-fix branch 2 times, most recently from ec39c34 to 4d30422 Compare April 15, 2024 14:43
@tillh-stripe tillh-stripe force-pushed the tillh/work-manager-fix branch 2 times, most recently from 6a4e414 to 39a4975 Compare May 16, 2024 16:47
@tillh-stripe tillh-stripe marked this pull request as ready for review May 16, 2024 16:56
@tillh-stripe tillh-stripe requested review from a team as code owners May 16, 2024 16:56
@tillh-stripe tillh-stripe merged commit 49d966b into master May 16, 2024
15 checks passed
@tillh-stripe tillh-stripe deleted the tillh/work-manager-fix branch May 16, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants