-
Notifications
You must be signed in to change notification settings - Fork 119
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
Amplify Sync Expression - to sort by provided field #1545
Comments
The data coming back from the sync query is ordered only by the hash key. Unfortunately we do not support specific sort during the sync operation. I will add this as feature request. |
To overcome the time out - Is there a specific API that can override the time out of ~1 minute. Currently I am doing a work around based on network status on datastore when the connection times out
|
Unfortunately there is no way to set this time out at this time. We will put this is a feature request as well. |
Is there an updated datastore library released for this feature request for syncing based on given criteria. Expectation : Messages should be synced based on creation date (SortKey), so that latest 5000 messages gets synced irrespective of contacts. |
I'm facing the similar issue and used the same workaround here, the sync time is over a minute at the first time syncing, here is the reported issue: https://github.com/aws-amplify/amplify-js/discussions/9680 Ultimately, set a correct syncExpression to minimize the sync time and reset the timeout during syncing should be the best approach, please help to put this as a feature request also, thanks! |
@poojamat Is there an issue created for taking this as a feature request ? Do you have a timeline on which version this would be released ? |
Problem : For chat application - for example, has 2 contacts with 5,000 messages each. If the sync expression syncMaxRecords is set to 5000, then messages from first contact gets synced and not for the second contact.
Expectation : Messages should be synced based on creation date (SortKey), so that latest 5000 messages gets synced irrespective of contacts.
Sync Expression:
DataStoreSyncExpression consumerDataSyncExpression = () -> ConsumerData.INCARCERATE_ID.eq(siteIncaratedId); DataStoreSyncExpression textMessageDataSyncExpression = () -> TextMessage.INCARCERATE_ID.eq(siteIncaratedId); DataStoreConfiguration datastoreBuilder = DataStoreConfiguration.builder() .errorHandler(STCDataStoreErrorHandler.instance()) .syncExpression(ConsumerData.class, consumerDataSyncExpression) .syncExpression(TextMessage.class,textMessageDataSyncExpression) .syncPageSize(1000) .syncMaxRecords(25000) .syncInterval(15, TimeUnit.SECONDS).build(); AWSDataStorePlugin dataStorePlugin = new AWSDataStorePlugin(datastoreBuilder); Amplify.addPlugin(dataStorePlugin);
GraphQL Schema
schema.zip
Exception
DataStoreException{message=Initial sync during DataStore initialization failed., cause=java.util.concurrent.TimeoutException: Timed out while performing initial model sync., recoverySuggestion=There is a possibility that there is a bug if this error persists. Please take a look at
https://github.com/aws-amplify/amplify-android/issues to see if there are any existing issues that
Replying to Closed issue
Can I get code sample of what your graphQL schema and the sync expression looks like? I am under the impression that it is supposed to sync based on a filter irrespective of which contact a message belongs in.
Originally posted by @raphkim in #1430 (comment)
The text was updated successfully, but these errors were encountered: