thanks, I figure it out 😊
Question about running threads: Do not automatically terminate threads when encountering errors.
-
I have a script that scans information from more than 500 websites and runs continuously without stopping. I usually run 25 threads, but after a day, I often have to restart the software because it seems like there are not enough threads running. It's possible that some websites or scripts encounter errors, leading to thread interruptions. Is there a way to ensure that there are always 25 threads running, and that websites with errors will be retried in the subsequent loops?
-
@BAS-Viet-Nam said in Question about running threads: Do not automatically terminate threads when encountering errors.:
Em chọn chế độ này rồi bác, nhưng chạy 1 ngày là vẫn bị tụt luồng, em nghi là do trong kịch bản chạy chưa lường hết các trường hợp, khi có lỗi xảy ra dẫn đến dừng luồng đó thì nó dừng luôn. không tạo luồng thay thế
-
@BAS-Viet-Nam said in Question about running threads: Do not automatically terminate threads when encountering errors.:
@ptt-bds Nếu đã chọn vậy rồi thì do cách bác viết rồi, có nhiều thứ ảnh hưởng ví dụ như Fail, các loại call functions.... nên chỉ có bác mới biết được vấn đề nó là gì :)
thì ý của em là làm sao để khi fail mà nó ko bị huỷ luồng đó đi ??
-
@ptt-bds Fail mình nói là hành động Fail ấy, ý mình là sợ bác cài đặt hành động fail sai, vì mình gặp nhiều bạn cài sai rồi, cứ có chỗ nào tích là tích vào :)), hoặc bác dùng sai các hành động như Call function in several threads hoặc Call function asynchronously hoặc một vấn đề nào khác.... đây là mình đoán thôi chứ project của bác mình không biết được.
-
@dung-bui
Cách này m đã từng dùng trước đây
https://community.bablosoft.com/topic/24272/how-do-i-create-a-notification-when-i-get-any-errors/2
Nhưng có một bất cập đấy là mọi lỗi, kể cả lỗi "mong muốn" và lỗi "không mong muốn" đều được xử lý như nhau, muốn xử lý khác phải thêm điều kiện vào. <Lỗi mong muốn là lỗi mà khi việc khởi động lại trình duyệt sẽ mang lại kết quả tốt, và ngược lại>
Vì thế mình đã không sử dụng điều này cho nhiều hành động, chỉ sử dụng cho những hành động cụ thể để kiểm soát dễ dàng hơn.
Nên hãy cân nhắc khi sử dụng nó, đây là nhận định cá nhân, không phải lời kêu gọi đầu tư. À lộn, đây là nhận định cá nhân, bác nên tìm ra lý do của mình để xử lý dứt điểm nó. :) -
@BAS-Viet-Nam mk hiểu vấn đề bạn đưa ra. nhưng mk nghĩ chọn chế độ Repat và Ignore Errors tập lệnh sau khi phân luồng sẽ xử lý dc yêu cầu của chủ thớt. Còn cụ thể cần logic tập lệnh và nhiều vấn đề khác bạn ạ
-
If you use English to communicate, more people will be able to help you.
-
@Fox said in Question about running threads: Do not automatically terminate threads when encountering errors.:
If you use English to communicate, more people will be able to help you.
I have a script that scans information from more than 500 websites and runs continuously without stopping. I usually run 25 threads, but after a day, I often have to restart the software because it seems like there are not enough threads running. It's possible that some websites or scripts encounter errors, leading to thread interruptions. Is there a way to ensure that there are always 25 threads running, and that websites with errors will be retried in the subsequent loops?
-
@ptt-bds said in Question about running threads: Do not automatically terminate threads when encountering errors.:
@Fox said in Question about running threads: Do not automatically terminate threads when encountering errors.:
If you use English to communicate, more people will be able to help you.
I have a script that scans information from more than 500 websites and runs continuously without stopping. I usually run 25 threads, but after a day, I often have to restart the software because it seems like there are not enough threads running. It's possible that some websites or scripts encounter errors, leading to thread interruptions. Is there a way to ensure that there are always 25 threads running, and that websites with errors will be retried in the subsequent loops?
Why did you duplicate your first message to me in this topic? It was in English anyway.
