Code Monkey home page Code Monkey logo

Comments (3)

RovoMe avatar RovoMe commented on June 10, 2024 1

Will check that on Monday. Our DEV environment is shut down during off-hours since we should not work during these hours :)

In the meantime I did my own "circular loop breaker" logic by storing the first name that is returned and then checking after each request whether I see that name again and then just break the loop. A bit of a duct tape and glue solution but it at least gets the job done for now.


edit:

@zimeg I tested the change now with a locally running bot using the test-workspace and it did stop after the end was reached :)

Thank you for the input and suggestion :) I still root for the conversations.lookupName option as this would spare us from iterating through several pages of channels. Our production workspace has way fewer channels, but still somewhere around 100+ channels I guess. Our test-workspace for sure is extreme but also a good test case whether our bot will scale with an "expanding" production workspace in future :)


2nd edit:

Oh, by the way, we also have like 3500+ groups created in the meantime and here the usergroups.list method doesn't have a pagination and therefore returns all the groups in one-go. It would by handy if there is a matching usergroups.lookupName API method as well (maybe also a pagination approach similar to channels?)

from java-slack-sdk.

zimeg avatar zimeg commented on June 10, 2024

Hey @RovoMe 👋 Really appreciate the code snippet and question! Having a conversations.lookupName method would be super useful here and I've shared this with our teams, but for now we can still tackle this with pagination.

Instead of checking for a null cursor for the end of results when paginating, a check for the empty string will be useful for knowing when no more results are present. Could you check if this change prevents the repeated looping?

-    } while (cursor != null);
+    } while (!cursor.isEmpty());

from java-slack-sdk.

zimeg avatar zimeg commented on June 10, 2024

@RovoMe great to hear! Just wanted to check that usergroups.list is returning all the responses with one call and not that it's missing pagination? I'll make a note of this too if so, but am not sure if it'll be tackled with any changes around the conversations.lookupName...

Thanks for checking the change and hope you enjoy the weekend!

from java-slack-sdk.

Related Issues (20)

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.