自动查重
This commit is contained in:
@@ -73,7 +73,7 @@ class PlagiarismService
|
||||
->where('article_id', $articleId)
|
||||
->value('journal_id');
|
||||
|
||||
|
||||
$this->log("plagiarism submit is running");
|
||||
$now = time();
|
||||
$checkId = Db::name('plagiarism_check')->insertGetId([
|
||||
'article_id' => $articleId,
|
||||
@@ -86,7 +86,6 @@ class PlagiarismService
|
||||
'ctime' => $now,
|
||||
'utime' => $now,
|
||||
]);
|
||||
$this->log("submit service act");
|
||||
Queue::push(
|
||||
'app\\api\\job\\PlagiarismRun',
|
||||
['check_id' => $checkId, 'file_path' => $filePath],
|
||||
@@ -132,8 +131,6 @@ class PlagiarismService
|
||||
]);
|
||||
|
||||
$tii->uploadFile($submissionId, $filePath, basename($filePath));
|
||||
$this->log('runUploadOnly uploaded submission_id=' . $submissionId);
|
||||
|
||||
$firstDelay = $this->ingestChainFirstDelaySec();
|
||||
Queue::later(
|
||||
$firstDelay,
|
||||
@@ -153,7 +150,7 @@ class PlagiarismService
|
||||
$this->markFailed($checkId, '[ingest] tii_submission_id empty');
|
||||
return;
|
||||
}
|
||||
|
||||
$this->log("runIngestPollStep is running");
|
||||
$maxAttempts = $this->ingestChainMaxAttempts();
|
||||
$interval = $this->ingestChainPollIntervalSec();
|
||||
$tii = new TurnitinService();
|
||||
@@ -198,6 +195,7 @@ class PlagiarismService
|
||||
return;
|
||||
}
|
||||
|
||||
$this->log("runTriggerSimilarityOnly is running");
|
||||
$tii = new TurnitinService();
|
||||
$sid = $check['tii_submission_id'];
|
||||
|
||||
@@ -254,7 +252,7 @@ class PlagiarismService
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
// try {
|
||||
$tii = new TurnitinService();
|
||||
$statusResp = $tii->getSimilarityStatus($check['tii_submission_id']);
|
||||
$status = isset($statusResp['status']) ? strtoupper($statusResp['status']) : '';
|
||||
@@ -301,24 +299,24 @@ class PlagiarismService
|
||||
['check_id' => $checkId, 'attempt' => $attempt + 1],
|
||||
self::QUEUE_CHAIN
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
// 网络抖动不要直接 fail,给一定容错次数
|
||||
if ($attempt < self::MAX_POLL_ATTEMPTS) {
|
||||
Queue::later(
|
||||
self::POLL_INTERVAL,
|
||||
self::JOB_POLL,
|
||||
['check_id' => $checkId, 'attempt' => $attempt + 1],
|
||||
self::QUEUE_CHAIN
|
||||
);
|
||||
$this->updateCheck($checkId, [
|
||||
'attempts' => $attempt,
|
||||
'error_msg' => '[poll] transient: ' . $e->getMessage(),
|
||||
]);
|
||||
return;
|
||||
}
|
||||
$this->markFailed($checkId, '[poll] exhausted: ' . $e->getMessage());
|
||||
throw $e;
|
||||
}
|
||||
// } catch (\Throwable $e) {
|
||||
// // 网络抖动不要直接 fail,给一定容错次数
|
||||
// if ($attempt < self::MAX_POLL_ATTEMPTS) {
|
||||
// Queue::later(
|
||||
// self::POLL_INTERVAL,
|
||||
// self::JOB_POLL,
|
||||
// ['check_id' => $checkId, 'attempt' => $attempt + 1],
|
||||
// self::QUEUE_CHAIN
|
||||
// );
|
||||
// $this->updateCheck($checkId, [
|
||||
// 'attempts' => $attempt,
|
||||
// 'error_msg' => '[poll] transient: ' . $e->getMessage(),
|
||||
// ]);
|
||||
// return;
|
||||
// }
|
||||
// $this->markFailed($checkId, '[poll] exhausted: ' . $e->getMessage());
|
||||
// throw $e;
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,7 +435,7 @@ class PlagiarismService
|
||||
|
||||
private function ingestChainPollIntervalSec()
|
||||
{
|
||||
return max(5, (int) Env::get('turnitin.ingest_chain_poll_interval', 15));
|
||||
return max(60, (int) Env::get('turnitin.ingest_chain_poll_interval', 15));
|
||||
}
|
||||
|
||||
private function ingestChainMaxAttempts()
|
||||
|
||||
Reference in New Issue
Block a user