Problem with Django

6 views
Skip to first unread message

אורי

unread,
Jul 7, 2024, 8:58:45 PM (9 days ago) Jul 7
to pywe...@googlegroups.com
Hi,

We are using Django for our website. I found out there is a problem. Sometimes the site finds that a user's profile picture is not valid. For example if it's black only. This is done via cron job. If the program finds that a user's profile pictures is invalid, it removed the photo from the profile and deactivate the user. But in the same time the user might access the website. His last visit time is saved to the database, and if the profile was active then it saves it as active. So it saves the profile is active after deactivating it by the cron job. The result is that a user who is not valid (=doesn't have a profile picture) is active on the database, after he has been deactivated. Is there something I can do to prevent this? This is a bug, and we have checks for this and an error message is sent to me (the admin). But I would like to know if there is something I can do to prevent this.

By the way, it may also happen that the user will use the site and it will save his picture again, so he will still have a profile picture after it has been removed from his profile. This is also a bug.

Our project is open source and you can see the code at https://github.com/speedy-net/speedy-net

Thanks,
Uri Rodberg, Speedy Net.

אורי

unread,
Jul 7, 2024, 9:06:23 PM (9 days ago) Jul 7
to pywe...@googlegroups.com
Hi,

I want to add that this scenario is rare. It happened only 3 times in the last year. And there are thousands of users using the site. But still it happens.

Thanks,
Uri.

Meir Kriheli

unread,
Jul 8, 2024, 2:43:46 AM (9 days ago) Jul 8
to pywe...@googlegroups.com
Hi,

Assuming I got the problem correctly, you can try deleting all the sessions belonging to the user. This is a bit expensive (CPU wise), as each session needs to be decoded. To optimize a bit, you can get just the non-expired sessions.

See f.ex. this answer:

Cheers

‪On Mon, Jul 8, 2024 at 4:06 AM ‫אורי‬‎ <u...@speedy.net> wrote:‬
Hi,

I want to add that this scenario is rare. It happened only 3 times in the last year. And there are thousands of users using the site. But still it happens.

Thanks,
Uri.


‪On Mon, Jul 8, 2024 at 3:58 AM ‫אורי‬‎ <u...@speedy.net> wrote:‬
Hi,

We are using Django for our website. I found out there is a problem. Sometimes the site finds that a user's profile picture is not valid. For example if it's black only. This is done via cron job. If the program finds that a user's profile pictures is invalid, it removed the photo from the profile and deactivate the user. But in the same time the user might access the website. His last visit time is saved to the database, and if the profile was active then it saves it as active. So it saves the profile is active after deactivating it by the cron job. The result is that a user who is not valid (=doesn't have a profile picture) is active on the database, after he has been deactivated. Is there something I can do to prevent this? This is a bug, and we have checks for this and an error message is sent to me (the admin). But I would like to know if there is something I can do to prevent this.

By the way, it may also happen that the user will use the site and it will save his picture again, so he will still have a profile picture after it has been removed from his profile. This is also a bug.

Our project is open source and you can see the code at https://github.com/speedy-net/speedy-net

Thanks,
Uri Rodberg, Speedy Net.

--
You received this message because you are subscribed to the Google Groups "PyWeb-IL" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyweb-il+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pyweb-il/CABD5YeG6UQLtF4YH4xANvXt87%2B1R_J992%3DsYHM1h3u1KfOKkFg%40mail.gmail.com.


--

אורי

unread,
Jul 8, 2024, 3:00:03 AM (9 days ago) Jul 8
to pywe...@googlegroups.com
Hi Meir,

I don't want to log out the user.

Thanks,
Uri.


Meir Kriheli

unread,
Jul 8, 2024, 4:37:35 AM (8 days ago) Jul 8
to pywe...@googlegroups.com
In that case, what's the meaning of de-activating a user?

אורי

unread,
Jul 8, 2024, 5:22:06 AM (8 days ago) Jul 8
to pywe...@googlegroups.com
It's an internal thing and in this specific case it means that he has to upload a new profile picture before he can activate himself. When not active he can't search for matches on Speedy Match and he will not appear in other users searches for matches. When the user remains active as I wrote before without a profile picture, this is a bug. Also notice he will become inactive only on Speedy Match because of not having a profile picture, on Speedy Net he remains active and it's different there - you don't need a profile picture to be active.

Uri.


Meir Kriheli

unread,
Jul 11, 2024, 2:57:05 AM (6 days ago) Jul 11
to pywe...@googlegroups.com
You've mentioned the pic was removed from the profile during the check.

How about using the profile pic (and absence of it) as a flag for matches search?


אורי

unread,
Jul 11, 2024, 6:36:23 AM (5 days ago) Jul 11
to pywe...@googlegroups.com
Hi Meir,

Yes, we use the profile picture in matches. Users without a profile picture will not get any matches. But anyway, I have a programmer working with me on the project, and I think we are ok now. We don't need any more help. Thank you.

Uri Rodberg, Speedy Net.

Reply all
Reply to author
Forward
0 new messages