diff --git a/src/controllers/tanksController.js b/src/controllers/tanksController.js index 0656f7c6..b9fdc327 100644 --- a/src/controllers/tanksController.js +++ b/src/controllers/tanksController.js @@ -1598,24 +1598,7 @@ exports.changeMotorStatus = async (req, reply) => { motor_status: updatedMotor.motor_status // Assuming motor_status is a field in your Tank model }); - // Schedule a check for motor_status after 2 minutes - setTimeout(async () => { - try { - // Fetch the motor_status again - const finalMotor = await Tank.findOne({ motor_id: motor_id }); - - // Check if motor_status is different from motor_stop_status - if (finalMotor && finalMotor.motor_status !== finalMotor.motor_stop_status) { - // If they are different, update motor_stop_status to motor_status - await Tank.findOneAndUpdate( - { motor_id: motor_id }, - { $set: { motor_stop_status: finalMotor.motor_status } } - ); - } - } catch (error) { - console.error("Error in setTimeout:", error); - } - }, 2 * 60 * 1000); // 2 minutes in milliseconds + } catch (err) { throw boom.boomify(err); }