I’m really not sure. You might need to go to /logs and see if you can see a better error message with a little bit more detail. It could not like the title or the body of the post or any number of things, but I think those wouldn’t throw a 500. It could be overloading your db and server especially if you have sidekiq running as well.
Is there reason why you are creating a posts/topics every 2 seconds via the api? Maybe it would be better to write an import script and run it on the server with sidekiq off.