Fresh install - User bugs again



  • Hey guys,

    I have recently done a fresh install over everything on my server, OS, Nginx, Nodejs, NodeBB etc..
    I have restored from a backup and the users/latest shows the incorrect online status.

    If we have 3 members logged in, it does not show them as logged in but it shows the latest 3 members are logged in instead.

    The /users/online shows the correct status for the correct users.



  • Can you update to latest and let me know if it still happens? Does it happen on this forum as well? If not I will hop on my mongodb instance.



  • You are up-to-date ```
    
    I updated to master too but that didn't change much other than the markdown not being rendered in the first post.
    
    Another thing I noticed was that the first post in every thread has been duplicated and is posted as the second post too.


  • This should fix the online/latest users bug.

    I noticed the other problem with duped main posts on your forum as well. Although I can't reproduce it on my mongodb forum. It looks like the upgrade script failed and the main post wasn't removed from the replies. You can confirm by looking at the database for one of the topics that has the problem.

    // check the topic data for mainPid
    db.objects.findOne({_key:"topic:100"}, {_id:0, _key:0});
    
    // check the replies and see if it has the mainPid too
    db.objects.find({_key: "tid:100:posts"}, {fields: {_id: 0, value: 1, score: 1}});
    

    Check the value of mainPid from the first query and then look for the same value in the result of the second one.



  • @baris db.objects.find({_key: "tid:100:posts"}, {fields: {_id: 0, value: 1, score: 1}});

    returns

    error: { "$err" : "Unsupported projection option: _id", "code" : 13097 }

    That commit has fixed the online user issue though, thanks!



  • You can probably remove those stuff and just use

    db.objects.findOne({_key:"topic:100"});
    db.objects.find({_key: "tid:100:posts"});
    


  • @baris said:

    db.objects.find({_key: "tid💯posts"});

    > db.objects.findOne({_key:"topic:100"});
    {
            "_id" : ObjectId("53c930aa94b197dbb6f1006b"),
            "_key" : "topic:100",
            "cid" : "2",
            "deleted" : 0,
            "lastposttime" : 1405974339177,
            "locked" : 0,
            "mainPid" : "570",
            "pinned" : 0,
            "poll:id" : 4,
            "postcount" : 12,
            "slug" : "100/messing-with-the-logo",
            "thumb" : "",
            "tid" : 100,
            "timestamp" : 1405694122358,
            "title" : "Messing with the logo...",
            "uid" : 1,
            "viewcount" : 232
    }
    
    
    > db.objects.find({_key: "tid:100:posts"});
    { "_id" : ObjectId("53c930aa94b197dbb6f10071"), "_key" : "tid:100:posts", "score" : 1405694122402, "value" : "570" }
    { "_id" : ObjectId("53c93be894b197dbb6f100c9"), "_key" : "tid:100:posts", "score" : 1405697000698, "value" : "571" }
    { "_id" : ObjectId("53c97bd094b197dbb6f101a9"), "_key" : "tid:100:posts", "score" : 1405713360694, "value" : "572" }
    { "_id" : ObjectId("53c9902294b197dbb6f101e3"), "_key" : "tid:100:posts", "score" : 1405718562441, "value" : "573" }
    { "_id" : ObjectId("53cd116994b197dbb6f1054b"), "_key" : "tid:100:posts", "score" : 1405948265908, "value" : "574" }
    { "_id" : ObjectId("53cd2c7d94b197dbb6f10571"), "_key" : "tid:100:posts", "score" : 1405955197830, "value" : "575" }
    { "_id" : ObjectId("53cd34e194b197dbb6f105a5"), "_key" : "tid:100:posts", "score" : 1405957345962, "value" : "576" }
    { "_id" : ObjectId("53cd356494b197dbb6f105cb"), "_key" : "tid:100:posts", "score" : 1405957476031, "value" : "577" }
    { "_id" : ObjectId("53cd359a94b197dbb6f105f3"), "_key" : "tid:100:posts", "score" : 1405957530537, "value" : "579" }
    { "_id" : ObjectId("53cd35b494b197dbb6f10604"), "_key" : "tid:100:posts", "score" : 1405957556026, "value" : "580" }
    { "_id" : ObjectId("53cd6d8b94b197dbb6f108c6"), "_key" : "tid:100:posts", "score" : 1405971851569, "value" : "585" }
    { "_id" : ObjectId("53cd774394b197dbb6f108de"), "_key" : "tid:100:posts", "score" : 1405974339177, "value" : "586" }
    
    


  • So as suspected mainPid 570 is in tid:100:posts but it shouldn't be.

    The upgrade script should have removed those here not sure why it is broken on your forum. Do you have a db backup before 6th june? That is when that upgrade script was added.

    You can run a one time script to fix all the sorted sets.

    Backup your database. Add this piece of code into this file. Run the forum in dev mode and browse to /debug/fixTopics. This will remove the mainPid from the sorted sets tid:<tid>:posts and tid:<tid>:posts:votes.

    Let me know if that fixes your problem.



  • @baris That worked, thanks for the quick fix man! ❤



  • I have just noticed that the user status on the profile page does not show correctly either.

    Shows offline when i am online.



  • This should fix it.



  • noticed it here too. I'll update and see if it fixes.



Suggested Topics

| |