Add retry to mitigate the pagination issue
Problem: The issue is because some "RuntimeMetadata" documents are missing for some AppFunctions. We have a theory that the search API from AppSearch has an intermittent issue when returning multiple pages. Somehow, in a rare scenario, the search API seems to return only the first page (10 documents by default) even though more pages exist. This is causing the MetadataSyncAdapter to think there are only 10 AppFunctions and thus remove the RuntimeMetadata of the rest. Mitigation: When MetadataSyncAdapter searches for static metadata and gets exactly 10 (the default page size) documents, send another search with a much higher page size. With this, we maintain the existing behavior for the majority of calls that are unaffected. Thus, it should be a low-risk fix. Bug: b/400670498 Test: Existing tests Test: manually modify appsearch to not sending more pages if the default page count is used. Can see the log: "03-26 17:06:40.609 1745 3484 D AppFunction: b/400587895: First search yields 10 results, but the second one with higher page size yields 41 results. schemaType = AppFunctionStaticMetadata" Change-Id: Ibe9a6da5df42ccd5bf247bef7e218198471fac16
Loading
Please register or sign in to comment