Giter Site home page Giter Site logo

Comments (8)

bitspittle avatar bitspittle commented on July 17, 2024

Hey, I am so sorry for the long delay in replying. I missed the notification and just saw it now! Especially, I really appreciate your quick example to repro.

For now, to avoid using a sleep, I would recommend solving this using runUntilSignal:

session {
  section {
    textLine("Do something...")
  }.runUntilSignal {
    aside { textLine(" - a") }
    aside { textLine(" - b") }
    aside { textLine(" - b") }
    aside { textLine(" - f") }
    signal()
  }
}

Note that you're running into a threading / race issue. When I ran this on my machine, one or two of the asides would actually print.

Beyond that, I will investiagate. I suspect what should happen is the run block shouldn't consider itself done as long as there are any remaining aside blocks queued up for rendering. It's been a while since I looked at this code though and it might be a hairy, subtle interaction...

from kotter.

bitspittle avatar bitspittle commented on July 17, 2024

OK, looked a little more. What's happening is that a section is responsible for processing any aside blocks enqueued by the run method.

But your section is ending so fast, it shuts down and then the run block continues to add more aside blocks. (section and run are two different threads working at the same time)

I'm experimenting to see if it's trivial enough to detect, when the run method finishes, if one or more asides are still left, at which point, we kick off one more render request for the section (which should print out those remaining asides).

But so far the code is fighting me a bit (because debugging subtle threading issues is hard)...

from kotter.

cedriessen avatar cedriessen commented on July 17, 2024

Thanks for looking into it and providing me with a solution.

from kotter.

bitspittle avatar bitspittle commented on July 17, 2024

You're welcome. BTW I'm planning on looking at this again today.

After getting stuck last time, I decided to detour a little. I ended up finally starting to write unit tests (something I've been meaning to do for Kotter a long time -- I always wanted good code coverage to be a requirement to tag this library as v1.0).

What pushed me over the edge was the motivation to come back to this very bug. I'm hoping I can write a test that I can quickly run hundreds/thousands of times, to make sure things are working as expected.

from kotter.

bitspittle avatar bitspittle commented on July 17, 2024

OK, got it. It wasn't really that hard to fix once I got familiar with the code again. This was a great bug -- thanks for reporting!

I also added a unit test for this issue, and ran it a lot. It seems to be a solid fix.

This will be fixed whenever 0.9.10 (or later) goes out. The signal fix above is harmless to keep at that point, but you won't need it anymore.

from kotter.

cedriessen avatar cedriessen commented on July 17, 2024

Ok. As mentioned on the other issue I will give it a try. Thanks for investing your time helping me out with that.

from kotter.

bitspittle avatar bitspittle commented on July 17, 2024

from kotter.

cedriessen avatar cedriessen commented on July 17, 2024

Just wanted to let you know: I've upgraded to 1.0.0-rc1 and things work like a charm :-)

from kotter.

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.