0

My User collection contains data such as

    {"user1":"zera",
     "my_status":"active",
     "date_creation" : ISODate("2013-10-01T10:15:52.055Z")
    }
    {"user2":"dfgf",
     "my_status":"noactive",
     "date_creation": ISODate("2013-10-01T08:55:41.212Z")
    }

I need to find each user with my_status :"active" and update their my_status after 24 hours from each user's date_creation. Can anyone suggest a method to do it using django?

4

1 回答 1

0

Well, I'd write an async task to keep polling the database to check for users with active status. If the user is active, update their status.

For the asynchronous tasks, you can use python-rq but to make things easier there's a django module for python-rq, it's django-rq. Also, Celery is another popular and good option. There's also a module for Django, you can find it here.

于 2013-10-03T12:27:25.087 回答