I am using platform events to send an event in from an external system that triggers a lead to be converted via apex. The incoming platform event sends data that is needed to convert the lead and also create multiple custom child records associated with an opportunity during the lead conversion. I have a custom object hanging off the opportunity object (1-to-many).
As part of the lead conversion logic, I first check if the lead has been converted already by running a SOQL statement. Since two incoming platform events are coming in within milliseconds of each other, the SOQL query returns empty result when I check to see if the lead has been converted already.
Is there a way to somehow get more synchronous behavior versus asynchronous with platform events and callouts?