https://linen.dev logo
Join Discord
Powered by
# haxe-ui
  • likely
    b

    bright-gpu-74537

    04/09/2023, 8:00 PM
    likely
  • but even commenting out the two things that are nulled it continues... hmm 🤔
    a

    ambitious-knife-25690

    04/09/2023, 8:01 PM
    but even commenting out the two things that are nulled it continues... hmm 🤔
  • it could be a thread issue, although, apart from this the threading in core/http has been fine?
    b

    bright-gpu-74537

    04/09/2023, 8:01 PM
    it could be a thread issue, although, apart from this the threading in core/http has been fine?
  • yeah everything has been fine
    a

    ambitious-knife-25690

    04/09/2023, 8:01 PM
    yeah everything has been fine
  • ok, so maybe its not that then, as if it was, i would have expected you to have bizarre issues in other places when updating the UI
    b

    bright-gpu-74537

    04/09/2023, 8:02 PM
    ok, so maybe its not that then, as if it was, i would have expected you to have bizarre issues in other places when updating the UI
  • it seems like it is an issue with setting main_timer to null
    a

    ambitious-knife-25690

    04/09/2023, 8:02 PM
    it seems like it is an issue with setting main_timer to null
  • which is odd
    a

    ambitious-knife-25690

    04/09/2023, 8:02 PM
    which is odd
  • so yeah, my guess is that once the http call finishes something is off
    b

    bright-gpu-74537

    04/09/2023, 8:02 PM
    so yeah, my guess is that once the http call finishes something is off
  • cause i don't reference main_timer in any http request
    a

    ambitious-knife-25690

    04/09/2023, 8:02 PM
    cause i don't reference main_timer in any http request
  • what does main_timer do?
    b

    bright-gpu-74537

    04/09/2023, 8:03 PM
    what does main_timer do?
  • could be a race condition
    b

    bright-gpu-74537

    04/09/2023, 8:03 PM
    could be a race condition
  • ```hx public function run(url:String) { main_timer = new Timer(200, () -> { if (!active) { if (!preloaded) { active = true; this.loadSearchStats(url); } if (!this.requested_all_search_pages && preloaded) { for (url in preload_search_pages) { this.getProductLinks(url); } trace('got all pages'); this.requested_all_search_pages = true; } if (!requested_all_products && product_links[product_pos] != null && requested_all_search_pages && preloaded) { active = true; this.getProductPage(product_links[product_pos]); } if (product_pos == this.product_links.length && this.product_links.length > 0) { requested_all_products = true; } } if (requested_all_products && this.data.length >= this.product_links.length) { trace('done'); this.completed = true; main_timer.stop(); } this.update(status); }); } ```
    a

    ambitious-knife-25690

    04/09/2023, 8:03 PM
    Copy code
    hx
        public function run(url:String) {
            main_timer = new Timer(200, () -> {
                if (!active) {
                    if (!preloaded) {
                        active = true;
                        this.loadSearchStats(url);
                    }
    
                    if (!this.requested_all_search_pages && preloaded) {
                        for (url in preload_search_pages) {
                            this.getProductLinks(url);
                        }
                        trace('got all pages');
                        this.requested_all_search_pages = true;
                    }
    
                    if (!requested_all_products && product_links[product_pos] != null && requested_all_search_pages && preloaded) {
                        active = true;
                        this.getProductPage(product_links[product_pos]);
                    }
    
                    if (product_pos == this.product_links.length && this.product_links.length > 0) {
                        requested_all_products = true;
                    }
                }
    
                if (requested_all_products && this.data.length >= this.product_links.length) {
                    trace('done');
                    this.completed = true;
                    main_timer.stop();
                }
                this.update(status);
            });
        }
  • basically an update loop
    a

    ambitious-knife-25690

    04/09/2023, 8:03 PM
    basically an update loop
  • nothing in here would make me think there's an issue
    a

    ambitious-knife-25690

    04/09/2023, 8:04 PM
    nothing in here would make me think there's an issue
  • at least imo
    a

    ambitious-knife-25690

    04/09/2023, 8:04 PM
    at least imo
  • its hard for me to grep that fully, but i feels like it could intefer with threads... like what does "getProductPage" do? Is that making an http request?
    b

    bright-gpu-74537

    04/09/2023, 8:05 PM
    its hard for me to grep that fully, but i feels like it could intefer with threads... like what does "getProductPage" do? Is that making an http request?
  • yeah
    a

    ambitious-knife-25690

    04/09/2023, 8:05 PM
    yeah
  • so yeah, that seems like a race condition, no?
    b

    bright-gpu-74537

    04/09/2023, 8:05 PM
    so yeah, that seems like a race condition, no?
  • but aren't timers synchronous?
    a

    ambitious-knife-25690

    04/09/2023, 8:06 PM
    but aren't timers synchronous?
  • ?
    b

    bright-gpu-74537

    04/09/2023, 8:06 PM
    ?
  • not at all.. they are async, other wise they would be holding up the main thread
    b

    bright-gpu-74537

    04/09/2023, 8:06 PM
    not at all.. they are async, other wise they would be holding up the main thread
  • Sys.sleep is sync
    b

    bright-gpu-74537

    04/09/2023, 8:07 PM
    Sys.sleep is sync
  • you might want to consider gracefully handling the timer shutdown... ie, flag it for "complete" and stop / null it once all threads have finished. Honestly, you shouldnt really need to, but i dont really understand the app or what its doing
    b

    bright-gpu-74537

    04/09/2023, 8:08 PM
    you might want to consider gracefully handling the timer shutdown... ie, flag it for "complete" and stop / null it once all threads have finished. Honestly, you shouldnt really need to, but i dont really understand the app or what its doing
  • yeah, it seems to work fine at first glance if i stop the timer rather than null it
    a

    ambitious-knife-25690

    04/09/2023, 8:09 PM
    yeah, it seems to work fine at first glance if i stop the timer rather than null it
  • i think that makes sense... maybe if you null it then it stops it and clears its callback (its an assumption)
    b

    bright-gpu-74537

    04/09/2023, 8:09 PM
    i think that makes sense... maybe if you null it then it stops it and clears its callback (its an assumption)
  • but oddly, the async requests affect the next time I hit "start" despite using a new class 🤣
    a

    ambitious-knife-25690

    04/09/2023, 8:10 PM
    but oddly, the async requests affect the next time I hit "start" despite using a new class 🤣
  • ie, it gets GC'd
    b

    bright-gpu-74537

    04/09/2023, 8:10 PM
    ie, it gets GC'd
  • so it still exists "somewhere"
    a

    ambitious-knife-25690

    04/09/2023, 8:10 PM
    so it still exists "somewhere"
  • yeah, i mean, i dont know fully what the app is doing, but you might want to reconsider this main timer... go for a queue or a pool or something
    b

    bright-gpu-74537

    04/09/2023, 8:11 PM
    yeah, i mean, i dont know fully what the app is doing, but you might want to reconsider this main timer... go for a queue or a pool or something
  • lets see what happens if i stop the timer then null the instance
    a

    ambitious-knife-25690

    04/09/2023, 8:11 PM
    lets see what happens if i stop the timer then null the instance
1...162716281629...1687Latest