Skip to content
This repository has been archived by the owner on Aug 25, 2022. It is now read-only.

Channel labels being duplicated #21

Closed
freejack opened this issue Feb 28, 2014 · 3 comments
Closed

Channel labels being duplicated #21

freejack opened this issue Feb 28, 2014 · 3 comments
Labels

Comments

@freejack
Copy link

Problem seems to be in 0.2 and latest dev versions. Happens when connecting to freenode or to our internal irc server.

@rickihastings
Copy link
Contributor

I've seen it happen before in odd situations. I'll look into it soon when I've got time.

On 28 Feb 2014, at 04:29, freejack notifications@github.com wrote:

Problem seems to be in 0.2 and latest dev versions. Happens when connecting to freenode or to our internal irc server.


Reply to this email directly or view it on GitHub.

@rickihastings
Copy link
Contributor

I've just pushed out a fix for this I think, I'm now just using a mongo upsert so it will know when to properly insert a tab or not, however, the duplicate tabs now exist in the database and will still be there.

I had to run a query to find out which were the suspects (86 of them in my database!)

db.tabs.aggregate(
    { $group: { 
        // Group by fields to match on (a,b)
        _id: { network: "$network", target: "$target" },

        // Count number of matching docs for the group
        count: { $sum:  1 },

        // Save the _id for matching docs
        docs: { $push: "$_id" }
    }},

    // Limit results to duplicates (more than 1 match) 
    { $match: {
        count: { $gt : 1 }
    }}
)

You can see in the results.docs arrays the duplicate tabs, I've just deleted all but one so their original tabs remain, there might be a way to do this automatically but my mongodb skills aren't the best.

@freejack
Copy link
Author

freejack commented Mar 7, 2014

Looks good now. Thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants