Skip to content

Commit

Permalink
fix message
Browse files Browse the repository at this point in the history
  • Loading branch information
kanasimi committed Feb 18, 2025
1 parent b96f531 commit 466b063
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 8 deletions.
8 changes: 7 additions & 1 deletion application/net/wiki/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -1662,7 +1662,8 @@ function module_code(library_namespace) {
return action.slice(0, 1);
}) ]);
}
if (this.actions.length > 1) {
if (this.actions.length > 1 || this.host
&& this.host.length > 1) {
library_namespace.debug(method + ': 正在執行中 ('
//
+ this.thread_count + ', ' + this.actions.length
Expand All @@ -1672,6 +1673,11 @@ function module_code(library_namespace) {
+ this.actions.slice(0, 9).map(function(action) {
return action.slice(0, 1);
}), 3, 'wiki_API_prototype_methods');

library_namespace.debug('當 promise 在此中斷跳出,'
//
+ '您可能需設置 `session.set_up_if_needed_run_next()`。', 1,
'wiki_API_prototype_methods');
}
if (library_namespace.is_debug(6)) {
console.trace(method);
Expand Down
7 changes: 5 additions & 2 deletions application/net/wiki/namespace.js
Original file line number Diff line number Diff line change
Expand Up @@ -3217,13 +3217,16 @@ function module_code(library_namespace) {
var configurations = wiki_API.parse.configuration(page_data);
if (configurations && !configurations.general) {
// 處理非正規名稱的情況。
[ 'General', 'GENERAL' ].some(function(alias) {
if (![ 'General', 'GENERAL' ].some(function(alias) {
if (configurations[alias]) {
configurations.general = configurations[alias];
delete configurations[alias];
return true;
}
});
})) {
library_namespace.warn('adapt_task_configurations: '
+ 'General configurations are not set.');
}
}
// console.trace(configurations);
// TODO: valid configurations 檢測數值是否合適。
Expand Down
16 changes: 12 additions & 4 deletions application/net/wiki/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* @fileoverview 本檔案包含了 MediaWiki 自動化作業用程式庫的子程式庫。
*
* TODO:<code>
* TODO: 以 {Promise} 與 OOP ({Site}, {Page}) 重寫。 <code>
</code>
Expand Down Expand Up @@ -89,6 +89,11 @@ function module_code(library_namespace) {
// e.g.,
// node 20201008.fix_anchor.js use_language=zh archives
function set_up_if_needed_run_next(run_next_status) {
if (this && this.host) {
library_namespace.warn('set_up_if_needed_run_next: '
+ '你想執行的可能是 `session.host.set_up_if_needed_run_next()`?');
}

run_next_status = Object.assign(run_next_status || Object.create(null),
// this: wiki session
{
Expand Down Expand Up @@ -118,10 +123,12 @@ function module_code(library_namespace) {
var index_of_old_tail = last_action && this.actions.length > 0
&& this.actions.lastIndexOf(last_action) || undefined;
// console.trace([ index_of_old_tail, this.actions.length ]);
if (index_of_old_tail >= 0
// 若有新添加的 actions,由於這些 actions 全被 push 進 queue,不會被執行到,
// 因此必須手動執行 this.next()。
if (index_of_old_tail >= 0 ? this.actions.length - index_of_old_tail > 1
: this.actions.length > 0) {
? this.actions.length - index_of_old_tail > 1
//
: this.actions.length > 0) {
// console.trace(this.actions);
run_next_status.needed_run_next = true;
return true;
Expand All @@ -132,7 +139,7 @@ function module_code(library_namespace) {
* session.check_if_needed_run_next(run_next_status) 可以執行多次。
* session.check_and_run_next() 只能在 promise 之後馬上執行一次。
*
* e.g., Inside session instance functions:<code>
* e.g., Inside session instance functions: <code>
var run_next_status = session && session.set_up_if_needed_run_next();
Expand All @@ -144,6 +151,7 @@ function module_code(library_namespace) {
session.check_and_run_next(run_next_status, promise);
// 直接跳出。之後會等 promise 出結果才繼續執行。
return;
</code>
*/
function check_and_run_next(run_next_status, promise, no_check) {
Expand Down
4 changes: 3 additions & 1 deletion application/net/work_crawler/ebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,9 @@ function module_code(library_namespace) {
// console.trace(promise_load_text_to_check);
// 先初始化完畢後再重新執行。
return promise_load_text_to_check.then(create_ebook.bind(this,
work_data));
work_data)
// TODO: for error
);
}
}

Expand Down

0 comments on commit 466b063

Please sign in to comment.