Handling Concurrency with API #364
Replies: 1 comment
-
Hey! Great question! This is mentioned a bit in the 'Limitations' section of the README but to go into a little more detail: Both pfSense and the API package contain configuration locks that helps prevent write conflicts. This does make concurrent API calls relatively safe in most situations. However, this is more of a safety net than a feature; concurrent API calls (for write actions at least) are still discouraged for a few reason:
In general, it's best to run API calls in sequence. In some cases a small delay between API calls may be necessary. If you do plan on leveraging concurrency, I strongly recommend testing thoroughly in a non-production environment to determine expected behavior. Hope this helps. Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi Jared @jaredhendrickson13
One general query. How does this API suite handle concurrency and race conditions? This is especially important with the context of updates happening to a single data file "config.xml" in pfSense. Does the API implement some sort of Lock or semaphore to address the potential of "config.xml" getting corrupted or having inconsistent updates on pfSense?
Not sure if it has been already discussed in this forum or not. Could not able find with search filters.
Thanks and cheers!
Beta Was this translation helpful? Give feedback.
All reactions