My action is called by WP Cron so I'm trying to prevent it from running twice at the same time. So, I have the following function that uses doing_action function to check if the action is running. Apparently, the code below can't run even when the action is not running. But when I removed the doing_action check, the code runs.
function upload_to_ipfs() {
if ( !doing_action( 'upload_file' ) ) {
//Code to run here
}
}
add_action( 'upload_file', 'upload_to_ipfs' );