CodeSOD: Find a Bar for This O... Note

CodeSOD: Find a Bar for This One

The text critiques a poorly designed "data pump" application used to synchronize data between Foo and Bar entities. The application involves a nightly batch job written in Quarkus and interacting with a legacy system. The primary function of the batch job is to identify and update Bar entities based on Foo entities. The code retrieves all Foo entities instead of filtering for missing Bar entities, which is inefficient. The core issue lies in the update process within a transaction that makes multiple web service calls. This design leads to performance problems, including time-outs, contention, and exhaustion of database connections. The use of long-lived transactions, the number of web service calls, and the lack of proper connection pool configuration all contribute to these issues. The author criticizes the necessity of manually managing transactions and the flakiness of the web service. The fundamental problem is the batch job approach itself, which leads to creating referentially unsound data. The author indicates that a redesign will eliminate the batch job altogether, improving the situation. The text concludes with an advertisement for a package management platform.