rails do something for 3 minutes

# Step 1: Define a method that performs the desired action
def perform_action
  # Your code for the action to be performed goes here
end

# Step 2: Get the current time
start_time = Time.now

# Step 3: Set the duration for the action to be performed (3 minutes)
duration = 3 * 60 # 3 minutes in seconds

# Step 4: Loop until the elapsed time reaches the desired duration
loop do
  # Step 5: Call the method to perform the action
  perform_action

  # Step 6: Check if the elapsed time has reached the desired duration
  break if (Time.now - start_time) >= duration
end