gforceg/node-hound

test failing "shouldn\'t raise two events for one change"

Opened this issue · 2 comments

fix failing test
change to a file raises multiple 'change' events.

Same thing is happening to me. I'm doing something like this to add/change a file.

if (part.filename !== '' && part.mimeType === 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') {
                            console.log(part)
                            gmail.users.messages.attachments.get({
                                userId: 'me',
                                messageId: id,
                                id: part.body.attachmentId
                            }, (err, { data }) => {
                                if (err) return console.log('Error getting attachment: ' + err);
                                fs.writeFile('./received_files/' + part.filename, data['data'], { encoding: 'base64' }, (err) => console.log(err));

                            });

It's giving me two change events even though it's only changing the file once.

yeah it's happening to me also

    var newblock=hound.watch(__dirname+'/block/latest');
        newblock.on('change',function(filename){
            filename=filename.split('block/')[1];
            log(filename);
            if(filename.indexOf('.')==-1){
                fs.readFile(__dirname+'/block/'+filename,'utf-8',function(e,block){
                    log('b...');
                    if(catchingup!=='waiting'&&resyncing==false){setTimeout(delay_block,10000,block);}
                    });
                }
            });