handle error state better for recommender service

This commit is contained in:
Albert Yi
2019-01-22 14:57:18 -08:00
parent 6b167d6055
commit 68a5a4be09

View File

@@ -46,7 +46,7 @@ module RecommenderService
) )
JSON.parse(resp.body) JSON.parse(resp.body)
end end
if ids == "error" if ids.is_a?(Hash) # error state
return [] return []
end end
Post.find(ids.reject {|x| x[0] == post_id}.map(&:first)) Post.find(ids.reject {|x| x[0] == post_id}.map(&:first))