Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

新增auth支持 #328

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

新增auth支持 #328

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Feb 17, 2017

No description provided.

@danhunsaker
Copy link
Contributor

One of the changes here seems helpful, namely the use of PID tracking to ensure better "thread safety" across forks.

That said, all the rest are breaking changes. Some bugfixes are reverted, and many features are removed. I suspect the changes in this PR were made to a much older version of the code than the most recent version in master.

Additionally, your second commit changes the namespace of the package, which cannot be accepted.

To address this, please close this PR, create a new branch even with the master branch of chrisboulton/php-resque (this repo), and make your changes on that branch before opening a new PR for just those changes. Remember, when you make a commit to a PR's branch, GitHub adds that commit to that PR.

Copy link
Contributor

@danhunsaker danhunsaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing the namespace is not something that can be merged.

Copy link
Contributor

@danhunsaker danhunsaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One other note that isn't specific to any given line - please make sure you use consistent spacing and indentation in PRs. I see at least one case where you fixed the indentation, but several more where you've added something with poor spacing.

@@ -1,4 +1,7 @@
<?php
require_once dirname(__FILE__) . '/Resque/Event.php';
require_once dirname(__FILE__) . '/Resque/Exception.php';

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines are from before Composer was introduced...

* and implement "thread" safety to avoid race conditions.
*/
protected static $pid = null;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems useful, though.

* @param mixed $server Host/port combination separated by a colon, DSN-formatted URI, or
* a callable that receives the configured database ID
* and returns a Resque_Redis instance, or
* @param mixed $server Host/port combination separated by a colon, or
* a nested array of servers with host/port pairs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dropping a lot of valid server definitions, here...

}

return $pid;
self::$redis->select(self::$redisDatabase);
return self::$redis;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Resque::fork() method is pretty essential to the way the library operates now. It shouldn't be removed.

return false;
}
return true;
self::redis()->rpush('queue:' . $queue, json_encode($item));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This removes a lot of error handling...

$counter = self::size($queue);
$result = self::redis()->del('queue:' . $queue);
return ($result == 1) ? $counter : 0;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, we still need to be able to remove jobs from the queue.

public static function generateJobId()
{
return md5(uniqid('', true));
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not strictly vital, but consistency is nice, so putting this in a method rather than duplicating it everywhere is helpful.

}

return $pid;
self::$redis->select(self::$redisDatabase);
return self::$redis;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this logic is unnecessary with Credis, and is in fact redundant. Assuming it dates from before the switch to Composer, as well.

$pid = getmypid();
if (self::$pid !== $pid) {
self::$redis = null;
self::$pid = $pid;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit still looks helpful, though.

{
self::$redisServer = $server;
self::$redisDatabase = $database;
self::$auth = $auth;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see why this might be tempting to have. Feels a bit superfluous, though.

@PreciselyAlyss
Copy link

I'm sure this is obvious in the code, but the PR title translates to Added auth support

danhunsaker added a commit to resque/php-resque that referenced this pull request Dec 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants