GithubHelp home page GithubHelp logo

file-queue's People

Contributors

petey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

file-queue's Issues

queue.length function always returning o

I had to modify the length function in order to get it to return correct values the way I am using it.

fs.stat ==> ulink was always reporting 2.

// Finds the length of the queue (list of files in new)
Maildir.prototype.length = function(callback) {
fs.readdir(this.dirPaths[NEW]+'/', function(err, files) {
if (err) { callback(err); }
else { callback(null, files.length); }
});
};

How to process the queue?

Hi,

I implemented a simple example using the file-queue. I don't understand how I should process the queue. When I run "pop" it will just take one message from the queue and processes it.

So I understand that I need to take care of the queue itself, meaning that I need to check the length constantly and run pop by my own logic. It's not like pop is called whenever there is a new file in the queue, right?

Thanks for clarifying.

Optimize listNew()

Hello,

how do you think is it possible to optimize code:

Maildir.prototype.listNew = function(callback) {

Maildir.prototype.listNew = function(callback) {
  this.fs.readdir(this.dirPaths[NEW], callback);
};

the point is for each pop operation it reads all content of the directory.

pop()->readdir()
pop()->readdir()
pop()->readdir()

In the sequence code

Queue.prototype.tryPop = function(messages, callback) {

at tryPop you use only 1 item from the array.

If the queue has size 1^e6 messages it .....

How about to optimize this place?
For example

  • add memoize
    or
  • consume result from listNew() until it has elements?
    Thank you.

Please add polling

Hello,

Problematic code is:

that.watcher = that.fs.watch(that.dirPaths[NEW], {}, function(err, messages) {

      that.watcher = that.fs.watch(that.dirPaths[NEW], {}, function(err, messages) {
        that.emit('new', [messages]);
      });

This code doesn't work for NFS3.

http://docs.libuv.org/en/v1.x/fs_event.html

    UV_FS_EVENT_WATCH_ENTRY = 1,
    /*
    * By default uv_fs_event will try to use a kernel interface such as inotify
    * or kqueue to detect events. This may not work on remote file systems such
    * as NFS mounts. This flag makes fs_event fall back to calling stat() on a
    * regular interval.
    * This flag is currently not implemented yet on any backend.
    */

Please, add polling: say for each 30-60 seconds fs.readdir -> if files are present emit 'new' event.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.