{"action":"created","issue":{"url":"https://api.github.com/repos/Flexget/Flexget/issues/1143","repository_url":"https://api.github.com/repos/Flexget/Flexget","labels_url":"https://api.github.com/repos/Flexget/Flexget/issues/1143/labels{/name}","comments_url":"https://api.github.com/repos/Flexget/Flexget/issues/1143/comments","events_url":"https://api.github.com/repos/Flexget/Flexget/issues/1143/events","html_url":"https://github.com/Flexget/Flexget/issues/1143","id":153402559,"number":1143,"title":"Trakt API lookup errors","user":{"login":"Tommatheussen","id":13683094,"avatar_url":"https://avatars.githubusercontent.com/u/13683094?v=3","gravatar_id":"","url":"https://api.github.com/users/Tommatheussen","html_url":"https://github.com/Tommatheussen","followers_url":"https://api.github.com/users/Tommatheussen/followers","following_url":"https://api.github.com/users/Tommatheussen/following{/other_user}","gists_url":"https://api.github.com/users/Tommatheussen/gists{/gist_id}","starred_url":"https://api.github.com/users/Tommatheussen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Tommatheussen/subscriptions","organizations_url":"https://api.github.com/users/Tommatheussen/orgs","repos_url":"https://api.github.com/users/Tommatheussen/repos","events_url":"https://api.github.com/users/Tommatheussen/events{/privacy}","received_events_url":"https://api.github.com/users/Tommatheussen/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Flexget/Flexget/labels/Pending%20information","name":"Pending information","color":"fef2c0"}],"state":"open","locked":false,"assignee":{"login":"crawln45","id":461440,"avatar_url":"https://avatars.githubusercontent.com/u/461440?v=3","gravatar_id":"","url":"https://api.github.com/users/crawln45","html_url":"https://github.com/crawln45","followers_url":"https://api.github.com/users/crawln45/followers","following_url":"https://api.github.com/users/crawln45/following{/other_user}","gists_url":"https://api.github.com/users/crawln45/gists{/gist_id}","starred_url":"https://api.github.com/users/crawln45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crawln45/subscriptions","organizations_url":"https://api.github.com/users/crawln45/orgs","repos_url":"https://api.github.com/users/crawln45/repos","events_url":"https://api.github.com/users/crawln45/events{/privacy}","received_events_url":"https://api.github.com/users/crawln45/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2016-05-06T08:25:18Z","updated_at":"2016-05-07T04:02:26Z","closed_at":null,"body":"When trying to call the flexget API for trakt lookup, these errors occurs.\r\nSome useful info might be that it does not occur on all all the calls (in the UI, when loading 1 page of the movie list, 3/10 do succeed to load)\r\n```\r\n2016-05-06 10:15 ERROR    flexget.api                   Exception on /trakt/movie/ [GET]\r\nTraceback (most recent call last):\r\n  File \"/usr/local/lib/python2.7/dist-packages/flask/app.py\", line 1475, in full_dispatch_request\r\n    rv = self.dispatch_request()\r\n  File \"/usr/local/lib/python2.7/dist-packages/flask/app.py\", line 1461, in dispatch_request\r\n    return self.view_functions[rule.endpoint](**req.view_args)\r\n  File \"/usr/local/lib/python2.7/dist-packages/flask_restful/__init__.py\", line 477, in wrapper\r\n    resp = resource(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/flask/views.py\", line 84, in view\r\n    return self.dispatch_request(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/flask_restplus/resource.py\", line 42, in dispatch_request\r\n    resp = meth(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/flexget/utils/database.py\", line 34, in wrapper\r\n    return func(*args, **kwargs)\r\n  File \"/usr/local/lib/python2.7/dist-packages/flexget/plugins/api/trakt_lookup.py\", line 120, in get\r\n    return jsonify(result.to_dict())\r\n  File \"/usr/local/lib/python2.7/dist-packages/flexget/plugins/api_trakt.py\", line 786, in to_dict\r\n    \"actors\": list_actors(self.actors),\r\n  File \"/usr/local/lib/python2.7/dist-packages/flexget/plugins/api_trakt.py\", line 838, in actors\r\n    self._actors[:] = get_db_actors(self.id, 'movie')\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/collections.py\", line 1155, in __setslice__\r\n    values = [__set(self, value) for value in values]\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/collections.py\", line 1045, in __set\r\n    item = executor.fire_append_event(item, _sa_initiator)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/collections.py\", line 717, in fire_append_event\r\n    item, initiator)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/attributes.py\", line 941, in fire_append_event\r\n    initiator or self._append_token or self._init_append_token())\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/unitofwork.py\", line 46, in append\r\n    sess._save_or_update_state(item_state)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 1607, in _save_or_update_state\r\n    self._save_or_update_impl(st_)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 1861, in _save_or_update_impl\r\n    self._update_impl(state)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/session.py\", line 1854, in _update_impl\r\n    self.identity_map.add(state)\r\n  File \"/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/identity.py\", line 132, in add\r\n    % (key, ))\r\nAssertionError: A conflicting state is already present in the identity map for key (<class 'flexget.plugins.api_trakt.TraktImages'>, (1,))\r\n```"},"comment":{"url":"https://api.github.com/repos/Flexget/Flexget/issues/comments/217605059","html_url":"https://github.com/Flexget/Flexget/issues/1143#issuecomment-217605059","issue_url":"https://api.github.com/repos/Flexget/Flexget/issues/1143","id":217605059,"user":{"login":"crawln45","id":461440,"avatar_url":"https://avatars.githubusercontent.com/u/461440?v=3","gravatar_id":"","url":"https://api.github.com/users/crawln45","html_url":"https://github.com/crawln45","followers_url":"https://api.github.com/users/crawln45/followers","following_url":"https://api.github.com/users/crawln45/following{/other_user}","gists_url":"https://api.github.com/users/crawln45/gists{/gist_id}","starred_url":"https://api.github.com/users/crawln45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crawln45/subscriptions","organizations_url":"https://api.github.com/users/crawln45/orgs","repos_url":"https://api.github.com/users/crawln45/repos","events_url":"https://api.github.com/users/crawln45/events{/privacy}","received_events_url":"https://api.github.com/users/crawln45/received_events","type":"User","site_admin":false},"created_at":"2016-05-07T04:02:26Z","updated_at":"2016-05-07T04:02:26Z","body":"My suggestion would be to build a request queue for things like this. Allowing the queue to go 1 at a time until completed. Probably has more to do with threads than anything."}}