playtime icon indicating copy to clipboard operation
playtime copied to clipboard

[Waiting on #174] WIP - Add rake task to sync items with Amazon

Open leesharma opened this issue 7 years ago • 0 comments

Resolves #62 (part 3/3)

Description

I broke #62 into three PRs for easier review: this is the final piece. (part 1: #173, part 2: #174)

Now that we have the new endpoint, I can add a rake task (rake items:sync) to go through and sync the local items with Amazon. The real work happens in ItemSyncJob. In order to get around Amazon rate limits, the requests are a little spaced out (see ItemSyncJob#sync_all!).

Risks/Tradeoffs

  • I decided against putting any of these methods on Item–to me, it seems cleaner to have an outside object doing the API calls.

  • The rake task calls #perform_now because we don't have any sort of messaging queue set up. Given our low traffic, this should be fine for now.

TODO

This PR is actually in progress. Here are the things I want to do before this gets merged:

  • [x] Add specs
  • [x] Batch the ItemLookup requests (you can send up to 10 ASINs in one request)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

So far, it hasn't! (Eventually it will be through spec/jobs/items_sync_job_spec.rb.)

leesharma avatar Oct 26 '17 18:10 leesharma