Hi,
Running some tests last week, we discovered a potential issue with synchronization in our lastest app: if it's kept offline for a period of time, at some points it queues so many tasks for the same source adapter, that once the device recovers connectivity the client will timeout before receiving an answer from the rhoconnect server, waiting for the rhoconnect server to finish all tasks on the backend DB. Temporarily, we have fixed this by using a higher timeout in rhoconfig.txt, and both thin and nginx.
However, sync still takes pretty much time (~60 secs). All this queued tasks could be done in parallel without problems, so I'm trying to follow the documentation to achieve it with Resque.
I've already managed to start the workers and see them in the resque web console, but they instantly fail with:
NoMethodError undefined method `reconnectls' for Rhoconnect::Store:Class
update: That error was due to faulty code in my Rakefile: after taking a look at the Rhoconnect::Store:Class I came to the conclusion that at some point I accidentaly added "ls" to the end of the reconnect method, so ignore it.
After fixing some errors I found, it seems its working now, when its tested I'll post the steps in case someone also needs them.
2 Replies
Hi Ruben Thanks for sharing it here. it will help other developers like us. We look forward to hear updates from you. Visnupriya R Kutir Mobility
This is what i've done:
1. Add :queue: in each source listed in the settings.yml following the example of the docs.
:sources:
Journey:
:queue: journey
:poll_interval: 0
JourneyStop:
:queue: journeyStop
:poll_interval: 0
DispatchUnit:
:queue: dispatchUnit
:poll_interval: 0
DispatchItem:
:queue: dispatchItem
:poll_interval: 0
2. Start resque workers with: QUEUE=* COUNT=5 rake resque:workers
3. This failed due to a missing dep: require 'rhoconnect/tasks'. Eventually I gave up trying to fix this due to limited ruby knowledge, and decided to remove the line and try again. Commenting it out, allowed the resque workers to start.
4. After succesfully starting the workers, I could see them on the Resque console. A sync attempt would still fail, due to some method expecting a symbol but getting a integer instead. This was fixed by removing the 'query=' part in the doSync() call in my app. It seems it doesn't like to get any other parameters passed. This was no issue since those parameters only send the version string to the server for logging purposes.
5. Now I could successfully sync for the first time using the resque workers, but it is still very unstable. 2 of 5 jobs will fail with 'error 500', however, i'm still not 100% sure that its not our backend causing this errors