Re: Best way to track user presence

2010-01-15 Thread E17
I know of celery, it's a good software, but little too complicated and
expensive for the task I'm asking about. I'll probably use built-in
session timeout, as Shawn suggests.
But I think eventually I'll come back to celery when my demands will
rise as I'll have a need for delayed processing in my Django-app.

I need to know all users presence statuses, and this statuses are
updated asynchronously for logged users using comet push. So I need
some kind of roster rather then crawling over all users to check their
last activity timestamp.

On Jan 15, 1:21 pm, David De La Harpe Golden
 wrote:
> E17 wrote:
> > I wouldn't like to use cron, as running full python execution stack is
> > quite expensive in terms of performance. For the same reason I don't
> > like to run this code on [every] request handlers.
>
> > Seems to me like better solution would be to use some outer deamon or
> > deamon-like proces that would handle this functionality. I've googled
> > out at least 2 solutions for that
>
> Well, celery is a comprehensive solution for general background and
> periodic task processing in conjunction with django and works very 
> wellhttp://ask.github.com/celery/introduction.html
>
> May not be necessary to do what you want though - if you have a last
> activity timestamp in the session, you could consider just lazily
> showing "away" status when it's more than a certain amount in the past
> when it comes to display the status, rather than eagerly updating a flag
> with some scanner background task. (I think the idea is you want "away"
> status to show well before any true session timeout leading to logout,
> right?)
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Best way to track user presence

2010-01-15 Thread E17
I think you are right, the built-in session timeout would be the best
and the most ideologically correct solution.
Thank you)

On Jan 15, 4:27 am, Shawn Milochik  wrote:
> Use the built-in session timeout. Probably a good idea in any case, to  
> protect your data and user privacy.
>
> If they don't log out, they time out.
>
> If you trust your users to have scripting enabled, you can even put a  
> JavaScript function on a timer to sent the browser to your logout URL.  
> It's just a nice-to-have, though -- the session timing out handles all  
> contingencies.
>
> Shawn
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Best way to track user presence

2010-01-15 Thread David De La Harpe Golden
E17 wrote:

> I wouldn't like to use cron, as running full python execution stack is
> quite expensive in terms of performance. For the same reason I don't
> like to run this code on [every] request handlers.
> 
> Seems to me like better solution would be to use some outer deamon or
> deamon-like proces that would handle this functionality. I've googled
> out at least 2 solutions for that 

Well, celery is a comprehensive solution for general background and
periodic task processing in conjunction with django and works very well
http://ask.github.com/celery/introduction.html

May not be necessary to do what you want though - if you have a last
activity timestamp in the session, you could consider just lazily
showing "away" status when it's more than a certain amount in the past
when it comes to display the status, rather than eagerly updating a flag
with some scanner background task. (I think the idea is you want "away"
status to show well before any true session timeout leading to logout,
right?)







-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Best way to track user presence

2010-01-14 Thread Shawn Milochik
Use the built-in session timeout. Probably a good idea in any case, to  
protect your data and user privacy.


If they don't log out, they time out.

If you trust your users to have scripting enabled, you can even put a  
JavaScript function on a timer to sent the browser to your logout URL.  
It's just a nice-to-have, though -- the session timing out handles all  
contingencies.


Shawn
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Re: Best way to track user presence

2010-01-14 Thread Brian Neal
On Jan 14, 7:30 pm, E17  wrote:
> Hi,
>
> in my Django application I need a way to track logged users presence.
>
> User gets an 'online' status when he/she logs in and 'offline' status
> when logs out, it's pretty simple. But what is the best way to handle
> non-logged-out sessions? One need to periodically check all sessions
> on last activity age and make some decisions depending on that age -
> i.e. set user status to 'away' of 'offline'.
>
> I wouldn't like to use cron, as running full python execution stack is
> quite expensive in terms of performance. For the same reason I don't
> like to run this code on [every] request handlers.
>
> Seems to me like better solution would be to use some outer deamon or
> deamon-like proces that would handle this functionality. I've googled
> out at least 2 solutions for that - django-cron (http://
> code.google.com/p/django-cron/) and a standalone Django Cron Jobs
> Daemon (http://www.djangosnippets.org/snippets/1348/).
>
> What is a better way or I missed something else?
>
> Thank you

Use some middleware to keep track of the last time you see a logged in
user.

BN
-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.




Best way to track user presence

2010-01-14 Thread E17
Hi,

in my Django application I need a way to track logged users presence.

User gets an 'online' status when he/she logs in and 'offline' status
when logs out, it's pretty simple. But what is the best way to handle
non-logged-out sessions? One need to periodically check all sessions
on last activity age and make some decisions depending on that age -
i.e. set user status to 'away' of 'offline'.

I wouldn't like to use cron, as running full python execution stack is
quite expensive in terms of performance. For the same reason I don't
like to run this code on [every] request handlers.

Seems to me like better solution would be to use some outer deamon or
deamon-like proces that would handle this functionality. I've googled
out at least 2 solutions for that - django-cron (http://
code.google.com/p/django-cron/) and a standalone Django Cron Jobs
Daemon (http://www.djangosnippets.org/snippets/1348/).

What is a better way or I missed something else?

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.