Repair pydantic threading problem.
Pydantic have a problem with correct working on threads. This MR applied semaphore in get_response_model function, which was sensitive on multithreading. Those changes eliminate problems with race conditions. Performance of this script was save, due to use of caching generated models.
Edited by Radosław Masłowski