{"action":"opened","issue":{"url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/672","labels_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/672/labels{/name}","comments_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/672/comments","events_url":"https://api.github.com/repos/mbleigh/acts-as-taggable-on/issues/672/events","html_url":"https://github.com/mbleigh/acts-as-taggable-on/issues/672","id":97822111,"number":672,"title":"find_or_create_all_with_like_by_name should not raise DuplicateTagError","user":{"login":"Nuru","id":2793313,"avatar_url":"https://avatars.githubusercontent.com/u/2793313?v=3","gravatar_id":"","url":"https://api.github.com/users/Nuru","html_url":"https://github.com/Nuru","followers_url":"https://api.github.com/users/Nuru/followers","following_url":"https://api.github.com/users/Nuru/following{/other_user}","gists_url":"https://api.github.com/users/Nuru/gists{/gist_id}","starred_url":"https://api.github.com/users/Nuru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Nuru/subscriptions","organizations_url":"https://api.github.com/users/Nuru/orgs","repos_url":"https://api.github.com/users/Nuru/repos","events_url":"https://api.github.com/users/Nuru/events{/privacy}","received_events_url":"https://api.github.com/users/Nuru/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-28T23:21:24Z","updated_at":"2015-07-28T23:21:24Z","closed_at":null,"body":"[`find_or_create_all_with_like_by_name`](https://github.com/mbleigh/acts-as-taggable-on/blob/c393f86419de10cfb98f21a4f64befb2b4e6d325/lib/acts_as_taggable_on/tag.rb#L79) raises `DuplicateTagError` under the race condition where:\r\n* it checks for the existence of a tag and does not find it\r\n* something else creates the tag\r\n* this thread tries to create the tag\r\n\r\nInstead of raising the error, it should go and find the newly created tag, since that is the promise of \"find or create\". The code is a little to meta for me to write an exact fix, but the standard [retry](https://coderwall.com/p/e8zu7q/using-retry-to-rescue-activerecord-recordnotunique) [fix](http://daniel.fone.net.nz/blog/2014/12/10/handling-token-generation-collisions-in-activerecord/) should work, or at least be given a shot at working before raising an error."}}