chatroom_schema() function in chatroom.install defines poll_freq and idle_freq in milliseconds, default value being 1,000 and 60,000 respectively.

However setInterval() in chatroom.js (line 9) treats pollInterval as if it is in seconds (by multiplying 1,000 to it).

[Chat settings] form on chatroom (and chat) edit mode treats them as seconds and save them accordingly.

Please review the code and decide which units to go with. Or fix the code so they are converted correctly.

Changing the schema is probably easier to fix because module's code seems to assume time is in seconds. However, this will require modification on chatroom_update_6201() in chatroom.install for correct upgrade path.

CommentFileSizeAuthor
#1 chatroom.install.patch3.45 KBKi
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Ki’s picture

FileSize
3.45 KB

Attached is the patch that I used to upgrade chatroom from 1 to 2.

These are changes contained in the patch.

* Change the default values for poll_freq and idle_freq to in seconds instead of milliseconds. Applies to chatroom and chatroom_chat tables. Reason explained above.

* Modify poll_freq and idle_freq to be in seconds in update routine.

* Load new chatroom nodes fully with old chatrooms to keep all information. In my case chatroom's association to organic groups would be lost otherwise.

* Two INSERT routines at the bottom would give complain about non-existing field names and they were fixed accordingly.

Anonymous’s picture

Ki, thanks for the patch. review coming soon.