handle error case for recommendation service

This commit is contained in:
Albert Yi
2019-01-08 14:49:47 -08:00
parent 42ad2527bd
commit fa6d86e882

View File

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