SiT! Bugs - SiT!
View Issue Details
0001749SiT!incidentspublic2011-12-15 14:482011-12-19 20:08
nicdev 
paulh 
normalminoralways
resolvedfixed 
Current GIT 
3.90beta1Current GIT 
0001749: Incident_update and Incident_email saves multiple drafts
When Updating an incident or sending an email, a new draft is saved every 10 seconds, creating an enormous amount of data in the Drafts DB table. It seems the drafid remains "-1" thus a new draft is created instead of updating the existing draft.
No tags attached.
png Image 008 2011 12 15.png (32,110) 2011-12-15 14:48
http://bugs.sitracker.org/file_download.php?file_id=203&type=bug
png
Issue History
2011-12-15 14:48nicdevNew Issue
2011-12-15 14:48nicdevFile Added: Image 008 2011 12 15.png
2011-12-15 16:20nicdevNote Added: 0004368
2011-12-19 20:03paulhNote Added: 0004376
2011-12-19 20:03paulhStatusnew => confirmed
2011-12-19 20:04paulhAssigned To => paulh
2011-12-19 20:04paulhTarget Version => 3.90beta1
2011-12-19 20:08paulhNote Added: 0004377
2011-12-19 20:08paulhStatusconfirmed => resolved
2011-12-19 20:08paulhResolutionopen => fixed
2011-12-19 20:08paulhFixed in Version => Current GIT

Notes
(0004368)
nicdev   
2011-12-15 16:20   
For info I have found the error, but I need someone to confirm it ...

Problem is that we use "Setinterval" with no time(which i assume defaults to 1mS) as well as PeriodicalExecuter every 10 seconds:
--- Code ---
new PeriodicalExecuter(function(pe) {
        setInterval("save_draft('"+<?php echo $id; ?>+"', 'update')")
    },
    10);
--- End ---
This causes the function "save draft" to be executed every mS continuously renewed every 10 seconds.

I changed the code as follows:
--- Code ---
new PeriodicalExecuter(function(pe) {
        save_draft('<?php echo $id; ?>', 'update')
    },
    10);

I confirm it works now.

Can someone confirm ?

Thanks
--- End ---
(0004376)
paulh   
2011-12-19 20:03   
I can't actually reproduce this though agree we don't need to call setInterval
(0004377)
paulh   
2011-12-19 20:08   
55aee85 tidies this up, cheers Nico