Thread safety



  • Hi,

    I am creating a small QT c++ application to populate our cloud backend with a lot of data, which include a file that I need to upload. Is it safe to call the enginio client in parallel? Or should I queue the requests, and only run one at the same time? The population process involves querying data from the backend to get some IDs, and then call the upload method.

    Thanks in advance!

    Greetings,
    Jeroen Dierckx



  • In general EnginioClient is reentrant and, as most of QObjects, should be used only from thread in which it was created.

    But it is perfectly fine to call multiple queries without waiting for them to finish for example:
    @
    EnginioReply *r1 = client.query(query1);
    EnginioReply *r2 = client.create(object2);
    EnginioReply *r3 = client.query(query3);
    @

    EnginioClient uses QNetworkAccessManager internally which parallels the request. So you do not have to do anything it is already done for you :-)

    Please mark that, depending on your engin.io plan, you may have different burst limit. The server may reject your queries if you post them too quickly.



  • OK, thanks a lot.

    I am using the evaluation plan for now, so I probably ran into those burst problems. I will wait a while between requests, but is there a specific error that I can catch, so I can retry the failed request?



  • Yes, EnginioReply will contain meaningful error message


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.