Skip to content
This repository has been archived by the owner on Nov 2, 2020. It is now read-only.

Commit

Permalink
refactor(Tracker): Separate announce data update function
Browse files Browse the repository at this point in the history
Signed-off-by: Rhilip <rhilipruan@gmail.com>
  • Loading branch information
Rhilip committed Jun 19, 2019
1 parent 50f0728 commit 22d69bc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@
- **README:** Fix Mailer Env typo

### Feat
- **Auth:** Add UserRecover Form
- **Auth:** Add full Advanced Options for Login
- **Cleanup:** Add disable cleanup job by set priority to 0
- **Auth:** Add UserRecover Form
- **Cleanup:** Cleanup dead peers
- **Debug:** Add extend debug output
- **Cleanup:** Add disable cleanup job by set priority to 0
- **Debug:** Remove DebugMiddleware
- **Debug:** Add extend debug output
- **Email:** Add email template
- **Form Validator:** Add library bootstrap-validator library
- **Frontend:** Add localforage As Cache Provider
- **Invite:** Add base invite table
- **Invite:** Finish invite system
- **Invite:** Add base invite table
- **Links:** Add full Links manage
- **News:** Fix news tag not appear in index
- **News:** Add Site News model
- **Register:** Can't copy password and paste to retyep_password
Expand Down
25 changes: 15 additions & 10 deletions apps/controllers/TrackerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,8 @@ public function actionIndex()

$this->checkSession($queries, $role, $userInfo, $torrentInfo);


// Push to Redis Queue and quick response
app()->redis->lPush('Tracker:to_deal_queue',json_encode([
'worker' => \apps\task\TrackerAnnounceTask::class,
'timestamp' => time(),
'queries' => $queries,
'role' => $role,
'userInfo' => $userInfo,
'torrentInfo' => $torrentInfo
]));
// Send all info to task worker
$this->sendToTaskWorker($queries, $role, $userInfo, $torrentInfo);

$this->generateAnnounceResponse($queries, $role, $torrentInfo, $rep_dict);
return Bencode::encode($rep_dict);
Expand Down Expand Up @@ -780,4 +772,17 @@ private function checkSession($queries, $seeder, $userInfo, $torrentInfo)
}

}

private function sendToTaskWorker($queries, $role, $userInfo, $torrentInfo)
{
// Push to Redis Queue and quick response
app()->redis->lPush('Tracker:to_deal_queue', json_encode([
'worker' => \apps\task\TrackerAnnounceTask::class,
'timestamp' => time(),
'queries' => $queries,
'role' => $role,
'userInfo' => $userInfo,
'torrentInfo' => $torrentInfo
]));
}
}

0 comments on commit 22d69bc

Please sign in to comment.