Hi,

Chat Room keeps telling me that:

user warning: Duplicate entry '27' for key 1 query: INSERT INTO chatroom_msg_archive (cmid, ccid, uid, msg_type, msg, session_id, recipient, modified) SELECT * FROM chatroom_msg WHERE ccid = 6 AND cmid < 213 in /home/parateam/public_html/includes/database.mysql.inc on line 172.

I tried deleting all entries in chatroom_msg_archive, that makes chat room work quietly once, and then it keeps bugging me again at next reload.
What can go wrong ?

Thanks,
Xav

Comments

darren oh’s picture

Assigned: Unassigned » darren oh

I will look into this when I have time if no one else does. Until then, you can prevent the error by unchecking "Automatically archive old messages" in admin/settings/chatroom.

skizzo’s picture

Just to confirm: I am getting the same error (also, displayed msg counter changes erratically). Thank you.
Duplicate entry &#039;399&#039; for key 1 query: INSERT INTO chatroom_msg_archive (cmid, ccid, uid, msg_type, msg, session_id, recipient, modified) SELECT * FROM chatroom_msg WHERE ccid = 7 AND cmid &lt; 400 in /var/www/cms50/includes/database.mysql.inc nella riga 172.

hiweed’s picture

Yes, I'm experiencing the same error as well:

user warning: Duplicate entry '1' for key 1 query: INSERT INTO chatroom_msg_archive (cmid, ccid, uid, msg_type, msg, session_id, recipient, modified) SELECT * FROM chatroom_msg WHERE ccid = 1 AND cmid < 422 in /var/www/drupal.meltonfoundation.org/includes/database.mysql.inc on line 172.
darren oh’s picture

This could happen if two users enter the chat at the same time. Automatically archiving old messages is a feature for advanced users. At the moment, archiving is done whenever a user enters the chat. The logic was that it should work for sites that didn't have cron set up.

Maybe archiving should be a cron job. Any user advanced enough to use this feature should also be advanced enough to set up cron. What do you think?

darren oh’s picture

Status: Active » Fixed

Fixed in CVS commit 63778. Turned out to be a simple error in a variable name.

xav’s picture

Even if you fixed it, I tend to think that archiving would better be done by cron. If the user can't install cron on its machine, there are ways around that.

Anonymous’s picture

Status: Fixed » Closed (fixed)