aws-samples / aws-sdk-unity-samples

This repository has samples that demonstrate various aspects of the AWS Mobile SDK for Unity, you can get the SDK source on Github (https://github.com/aws/aws-sdk-net)
Other
161 stars 107 forks source link

Table.Query problem. #1

Closed thewall01210 closed 9 years ago

thewall01210 commented 9 years ago

I'm currently working on an iOS app in Unity, and querying a table for messages. When I query the table the first time, the search that is returned by Table.Query is valid, and all the appropriate results are returned. The second time I call Table.Query, your logging does not show that a WWW request has been made or completed. Nothing is returned and search.Count does not contain a value. I am not using the async version of the call, and I'm executing the request inside of a thread.

Some things to note: I'm using Search.Count as a loop condition instead of Search.IsDone, since the loop would execute too many times when I was using the async version of query. In addition to this I had been using ThreadPool.QueueUserWorkItem to execute the search, but had moved it to its own dedicated thread for testing purposes.

` void GetMessage(object prefix) { var filter = new QueryFilter(MESSAGE_PREFIX_KEY, QueryOperator.Equal, prefix.ToString()); _teamMessageData.Clear();

    Search search = null;
    try
    {
        search = _teamMessages.Query(filter);
    }
    catch(Exception ex)
    {
        Debug.LogException(ex);
    }

    if(search == null)
    {
        Debug.Log("returnning null");
        return;
    }

    Debug.Log("SearchCount: " + search.Count);
    while(_teamMessageData.Count != search.Count)
    {
        if(search.Count < 1)
            break;

        _teamMessageData.AddRange(search.GetNextSet());
    }

    _processTeamMessages = true;
    search.Reset();

} `