Skip to content

Conversation

@stmeyer
Copy link
Contributor

@stmeyer stmeyer commented Dec 1, 2017

If posix is not enabled the filename is created as sha1 hash:

Queue\Shell\QueueShell
	/**
	 * @return string
	 */
	protected function _retrievePid() {
		if (function_exists('posix_getpid')) {
			$pid = (string)posix_getpid();
		} else {
			$pid = $this->QueuedJobs->key();
		}

		return $pid;
	}

and $pid = $this->QueuedJobs->key(); is set as

	/**
	 * Generates a unique Identifier for the current worker thread.
	 *
	 * Useful to identify the currently running processes for this thread.
	 *
	 * @return string Identifier
	 */
	public function key() {
		if ($this->_key !== null) {
			return $this->_key;
		}
		$this->_key = sha1(microtime());
		return $this->_key;
	}

@stmeyer stmeyer changed the title fix is posix is not enabled (e.g. Windows) fix if posix is not enabled (e.g. Windows) Dec 1, 2017
@codecov-io
Copy link

codecov-io commented Dec 1, 2017

Codecov Report

Merging #158 into master will increase coverage by 0.18%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##             master    #158      +/-   ##
===========================================
+ Coverage     47.72%   47.9%   +0.18%     
  Complexity      230     230              
===========================================
  Files            15      15              
  Lines           901     860      -41     
===========================================
- Hits            430     412      -18     
+ Misses          471     448      -23
Impacted Files Coverage Δ Complexity Δ
src/Model/Table/QueuedJobsTable.php 55.18% <0%> (+0.39%) 64 <0> (ø) ⬇️
src/Controller/Admin/QueueController.php 31.34% <0%> (-1.52%) 17% <0%> (ø)
src/Shell/Task/QueueExampleTask.php 62.5% <0%> (-1.5%) 3% <0%> (ø)
src/Shell/Task/QueueRetryExampleTask.php 83.78% <0%> (-0.84%) 5% <0%> (ø)
src/Model/Table/QueueProcessesTable.php 72.97% <0%> (-0.2%) 9% <0%> (ø)
src/Shell/Task/QueueProgressExampleTask.php 0% <0%> (ø) 5% <0%> (ø) ⬇️
src/Shell/Task/QueueExecuteTask.php 0% <0%> (ø) 5% <0%> (ø) ⬇️
src/Shell/Task/QueueTask.php 50% <0%> (ø) 3% <0%> (ø) ⬇️
src/Shell/Task/QueueSuperExampleTask.php 0% <0%> (ø) 3% <0%> (ø) ⬇️
src/Shell/Task/QueueEmailTask.php 0% <0%> (ø) 25% <0%> (ø) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a43c9fb...9495de6. Read the comment docs.

@dereuromark dereuromark merged commit a75e3a4 into dereuromark:master Dec 1, 2017
@inspectorman
Copy link

inspectorman commented Jan 12, 2018

Hello, I have a similar issue whe trying to kill workers:

^bin\cake queue kill
1 processes:
 - 99bf23f500cd86bda0f8ac283517a44b7e1b836e (last run @ 12/01/18, 6:47 p.m.)
Process (99bf23f500cd86bda0f8ac283517a44b7e1b836e/all)
> all
PHP Fatal error:  Call to undefined function Queue\Model\Table\posix_kill() in \app\vendor\dereuromark\cakephp-queue\src\Model\Table\QueuedJobsTable.php
on line 585

I'm running cakephp on easyphp - Windows 7.

thanks in advance

@dereuromark
Copy link
Owner

Interesting, how else could we kill it then in this case?

@dereuromark
Copy link
Owner

@dereuromark
Copy link
Owner

This should fix things for now: 340f9df

@inspectorman
Copy link

inspectorman commented Jan 13, 2018

Hello dear Mark,

This should fix things for now: 340f9df

I've tryed your solution, however, the kill command is not recongnized.

I've tried thishttps://technet.microsoft.com/es-es/library/bb491009.aspx

The Taskkill command works on Windows 7.
And it works.

regards.

@dereuromark
Copy link
Owner

Can you make a PR with your suggested changes, please?
Most here - incl me - run everything on Unix.

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.

4 participants