Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Not existing ASIN break synchronization workflow #69

Open
dArignac opened this issue Sep 21, 2015 · 2 comments
Open

Not existing ASIN break synchronization workflow #69

dArignac opened this issue Sep 21, 2015 · 2 comments
Assignees
Labels

Comments

@dArignac
Copy link
Member

If you try to synchronize a non-existent ASIN, the sync workflow breaks. E.g. B00GK7MFXC.

@dArignac dArignac added the bug label Sep 21, 2015
@dArignac dArignac self-assigned this Sep 21, 2015
@dArignac dArignac added this to the NEXT milestone Sep 21, 2015
@dArignac dArignac modified the milestones: v0.5, v0.4 Oct 26, 2015
@dArignac
Copy link
Member Author

The exception is

[2015-12-12 09:20:51,424: ERROR/Worker-5] Lookup for the following ASINs failed: B00GK7MFXC
[2015-12-12 09:20:51,426: ERROR/MainProcess] Task price_monitor.product_advertising_api.tasks.SynchronizeProductsTask[5d22c892-68e1-4858-b3e3-9540459b9e7f] raised unexpected: AttributeError("'NoneType' object has no attribute 'items'",)
Traceback (most recent call last):
  File "/home/alex/projects/github/django-amazon-price-monitor/price_monitor/product_advertising_api/tasks.py", line 188, in run
    for asin, amazon_data in ProductAdvertisingAPI().item_lookup(item_ids=list(products.keys())).items():
AttributeError: 'NoneType' object has no attribute 'items'

@dArignac
Copy link
Member Author

Well, the workflow does not break, only the exception is thrown. Synchronization of other products still works.

As adding in frontend is the first step and querying the amazon api the second (after the frontend already has reloaded - depends a little on how fast the server is but usually the api call isn't done upon frontend refresh) the user currently has no feedback if the addition failed.

We should think about a workflow that solves this issue. The state of the product in this case is:

>>> Product.objects.get(asin='B00GK7MFXC').status
0
>>> Product.objects.get(asin='B00GK7MFXC').date_last_synced is None
True
>>> Product.objects.get(asin='B00GK7MFXC').title is None
True

We could refactor this into a property. The frontend then somehow should be able to find out, that the product is broken.

But I don't where where we would put this in the frontend workflow.
I could imagine that after adding a product (or a list of products) we see a overlay waiting till the synchronization is done with the status (and the possibility to remove invalid ones?). Or the workflow stays the same but we have a kind of notification that the product addition failed.

What do you think, @mmrose ?

If we've chosen a way, need to separate into a new ticket.

@dArignac dArignac assigned mmrose and unassigned dArignac Dec 12, 2015
@dArignac dArignac removed this from the v0.5 milestone Dec 12, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants