title: updating database with threading.Timer doesn't update it properly
body: <p>I am working on a website. </p>
  
  <p>When a user logs-in to the site from a new device, I mail a validation code to the user.</p>
  
  <p>I don't want to resend new validation codes if user tries to log-in within 10 seconds because of failed log-in attempt. </p>
  
  <p>So I am saving the device-id of the browser he tried to log-in from in the DB. And calling a function to clear the device-id's in the DB after 10 seconds.</p>
  
  <p>I wrote the following code for that purpose:</p>
  
  <pre><code>code = validation_code
  user_object.ip_validation_code = code
  user_object.pre_validation_devices[device_used] = code
  
  def clear_pre_validation_devices():
      user_object.pre_validation_devices = {}
      user_object.save()
  
  Timer(30.0, clear_pre_validation_devices).start()
  user_object.save()
  </code></pre>
  
  <p>After executing the code, I've found that this is not clearing the filed <strong>pre_validation_devices</strong> as I expected.</p>
  
  <p>I am using Django 1.6 and Mongo DB, I will be grateful for any help.</p>
  
  <p>Thank you</p>