Node autocomplete with Redis

NodeBB Development

Suggested Topics


  • 0 Votes
    4 Posts
    327 Views

    @pitaj @gasoved Resolve my issues .. Thank you for your feedback.

  • 0 Votes
    1 Posts
    1k Views

    Hi,
    Have NodeBB used "optimistic concurrency locking"?
    I think in NodeBB there is 'UPVOTE' concept,
    While upvoting there has to be 'Optimistic concurrency locking',
    So it can handle multiple database insert operation at a time while upvoting single post by multiple users.

    Please let me know where do I find the code for 'Optimistic Concurrency locking',
    and guide me how to handle multiple insert operation at a time in redis database.

    Thanks!!

  • 0 Votes
    1 Posts
    2k Views

    Well, I have this issue that I need to do following things:
    1.Mongo Find
    2. Foreach
    3. MongoFind
    4 one more Foreach.

    because of asynchronaus mongo calls it is difficult to get proper result, however process.nextTick should handle this problem and still I have problem:

    function find(dbComm) {

    dbComm.forEach(function (current) { id= parseFloat(current.ID); db.anotherCollection.find({ ID: id}, function (error, result) { result.forEach(function (rank) { if (parseFloat(result.ID) == parseFloat(current.ID)) { rank.rank = 'Some calculations'; } }); }); });

    }

    app.get('/someparams', function (req, res) {

    db.collection.find().sort({ "rank": order }).skip(pagenumber).limit(5, function (err, result) { process.nextTick(function () { find(result, function () { }) }); process.nextTick(function () { res.send(result); }); });

    And on client side I should recive an array where the rank equals 'Some Calculations'
    but unfortunetly it is not...
    However...! If I add setTimeout(function(){}) before res.send(result) (and res.send(result) will be placed inside setTimeout) it actually does work and on client side I recive data with "Some Calculations" but it is just timeout and it fails sometimes and client dont recive "Some Calculations"
    if I put process.nextTick instead of setTimeout it doesnt work and "Some calc..." are not sent.

    Something is beeing done eralier then it should (probably in forEach in find() function)
    and my question is how to deal with it? maybe I should put process.nextTick in different function ?

  • 0 Votes
    6 Posts
    3k Views

    use replicaset if configured by Icehunter · Pull Request #3091 · NodeBB/NodeBB

    I use a replicaset. Here's a patch to use as well. config.json: { "url": "http://localhost:4567", "secret": "fae93eb7-f17b-429d-a614-4783d8466517", "database": "mongo", "mongo": { "host": "127.0.0.1,127.0.0.1,127.0.0.1", "port": "27017,27018,27019", "username": "", "password": "", "database": "nodebb" } }

    favicon

    GitHub (github.com)

    Made a pull request for it.

  • 0 Votes
    2 Posts
    1k Views

    Hi @aaron, Redis takes snapshots every fifteen minutes, and saves it to a folder defined in your Redis configuration (perhaps /var/lib/redis).

    Personally, I just tarzip it hourly and leave it at that. If you're worried about persistence (as in, 15 minutes is too long), you can always enable the "append-only file" and/or lower the snapshot interval

    For some not-so-light reading, check out the Redis article on Persistence.