Best practice for synchronizing products/orders etc. with rails shopify_app

Highlighted
Shopify Partner
30 0 1

Hi,

 

I am working on a new app, using rails which I have not worked with previously.

I am using the shopify_app gem.

I would like to synchronize various elements from a shop when the app is installed, e.g. orders and products.

As far as I can see, there's no out-of-the-box solution for this in the shopify_app gem?

 

What is best practice for such synchronizations?
So far my best guess is to:

  1.  Update config/initializers/shopify_app.rb with the following line:
    config.after_authenticate_job = { job: "Shopify::AfterAuthenticateJob", inline: false }
  2. Add after_authenticate_job.rb to app/jobs/shopify
  3. Apply the logic for synchronization in the job (taking the leaky bucket algorithm into account, as well as paging)
  4. Adding parameters to shop.rb that detects whether the various synchronizations are complete, to avoid synchronization on each authentication

Is the above appropriate, or are there better ways to do this?

 

Thanks,

-Louise

0 Likes
Community Manager
Community Manager
618 45 76

Hi @Louise_Elmose_H,

 

That's definitely a good approach! A background job that can pull the data upon initial authorization (as far as I know), is fairly standard practice for other apps.

 

It may also be worthwhile signing up for the closed beta to our new bulk API endpoints, which will allow you to fetch the data you need in one call. Signup here!

 

Cheers

0 Likes