Open BenTilbrook opened 5 years ago
Appears to be a similar issue to #103.
Same issue here. I think the problem is with the code generator for queries. The generated code implementing the queries does not override the toString() method and always return the object reference. So when the base query executor uses 'getKey()' method, it will generate object reference which changes with every app restart. When can we have a fix for this?
Same issue. When to fix it?
Thanks all for the report -
I believe I noticed this issue while working on a cleanup of the tests, as well.
Don’t have a fix date for this yet, but this looks high priority.
I have fixed it and seems work fine.
Refer to aws-mobile-appsync-sdk-ios, change mehtod "getkey" in com.amazonaws.mobileconnectors.appsync.AWSAppSyncDeltaSync.java
private String getKey( ) {
return getKey(baseQuery) + getKey(subscription) + getKey(deltaQuery);
}
private String getKey(Operation operation) {
String key = "";
if (operation != null) {
key += operation.getClass().getSimpleName();
Set<String> keys = operation.variables().valueMap().keySet();
if (!keys.isEmpty()) {
List vars = new ArrayList(keys);
Collections.sort(vars);
key += vars.toString();
}
}
return key;
}
Hope official fix soon.
Describe the bug The base query executes regardless of whether the elapsed time exceeds the configured base refresh interval, if the process is restarted. This is because the cache key used is unstable and based on
toString()
.The specific API in use here is:
To Reproduce
sync
operation, awaiting a successful base responsesync
operation again within 10 minutes of the first syncExpected behavior When running the app for the second time, the delta query is executed because the base refresh interval has not elapsed.
Actual behavior The base query is executed again, because the database key is unstable and will never match the previous process instance.
Environment(please complete the following information):
2.10.0
Device Information (please complete the following information):
28
28
Additional context The SQLite database key used to store the
last_run_time
of a delta sync operation is generated using string concatenation of the queries and subscriptionstoString()
values, resulting in an unstable value that is unusable between process instances.Example key:
I would expect the key to be based on the GraphQL query snippets themselves.