Giter Site home page Giter Site logo

Comments (11)

wrjlewis avatar wrjlewis commented on May 22, 2024

That is not good!

When you were using 0.5, did you see any errors in the search results?

from notion-search-alfred-workflow.

wrjlewis avatar wrjlewis commented on May 22, 2024

Sounds like code not exiting a loop, perhaps due to this addition to the code

    while True:
        if (parent_table == "block"):
            try:
                stack.append(recordMap.get('block').get(id).get('value').get('properties').get('title')[0][0])
            except:
                pass
            parent_table = recordMap.get('block').get(id).get('value').get('parent_table')
            id = recordMap.get('block').get(id).get('value').get('parent_id')
        if (parent_table == "collection"):
            try:
                stack.append(recordMap.get('collection').get(id).get('value').get('name')[0][0])
            except:
                pass
            parent_table = recordMap.get('collection').get(id).get('value').get('parent_table')
            id = recordMap.get('collection').get(id).get('value').get('parent_id')
        if (parent_table == "space"):
            break

from notion-search-alfred-workflow.

wrjlewis avatar wrjlewis commented on May 22, 2024

If the 100% CPU usage is reproducible, that would be very helpful to determine a fix.

from notion-search-alfred-workflow.

mvaneijgen avatar mvaneijgen commented on May 22, 2024

No I can't see any errors in the debug console. I've made a screen recording. It doesn't create multiple Python instances, just each time I search a new one will be created, but they all use around the 90% CPU.

from notion-search-alfred-workflow.

wrjlewis avatar wrjlewis commented on May 22, 2024

An easy fix will be to change the while true loop to instead only loop 10 or 20 times, the logic builds the subtitle of the search result and aims to break out of the loop once it's traversed up the navigation tree. 10 should do, there are not many pages with more than 10 parent pages I'd say, and even if that was the case you wouldn't be able to fit more pages into the subtitle anyway.

To fix:
On line 207 change while True:
to
for x in range(10):

to notion.py in:
../Alfred Prefs/Alfred.alfredpreferences/workflows/user.workflow.0FA07E26-FD9B-49AD-B43E-B92E6C0D289E/

You might have a different user.worfklow folder, I'm not sure if that is the same for everyone.

from notion-search-alfred-workflow.

wrjlewis avatar wrjlewis commented on May 22, 2024

Would you mind changing that line in your code, keeping the indentation the same?
The change should be effective immediately, and some new notion searches will hopefully not cause 100% CPU.
IF I've found the problem.

from notion-search-alfred-workflow.

wrjlewis avatar wrjlewis commented on May 22, 2024

Just seen your video, I think that points towards the while true loop issue which is attempting to build the search subtitles.
Will be interesting to see what your subtitles look like after the fix above, I presume one or two results might be missing subtitles (bearing in mind pages at the top level, ie space level, do not have subtitles anyway)

from notion-search-alfred-workflow.

mvaneijgen avatar mvaneijgen commented on May 22, 2024

That fix seems to do the trick!

This is what my search result looks like.
Screen Shot 2022-11-29 at 16 41 48

from notion-search-alfred-workflow.

wrjlewis avatar wrjlewis commented on May 22, 2024

Ah good news! Thank you for testing and for raising this issue, I'll push a fix. The next time you load a search and hit enter it should update automatically.
For those currently experiencing this issue, hit enter in the ns workflow if you can, but you may need to update manually to the appropriate Alred4 or Alfred5 download as linked to here https://github.com/wrjlewis/notion-search-alfred-workflow

from notion-search-alfred-workflow.

wrjlewis avatar wrjlewis commented on May 22, 2024

Thanks for your support @mvaneijgen 🙌
I've pushed a fix now so you can download that manually (Alfred5), if it hasn't already automatically updated.

from notion-search-alfred-workflow.

mvaneijgen avatar mvaneijgen commented on May 22, 2024

You thanks for the support and the amazing work! 🎉

from notion-search-alfred-workflow.

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.