Skip to content

Commit

Permalink
feat: update read timeout value and add devspace config for faster fe…
Browse files Browse the repository at this point in the history
…edback loop when debugging

build: [release]
  • Loading branch information
lots0logs committed Jan 26, 2022
1 parent f9a982a commit b524809
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,5 @@ vendor
.DS_Store
.AppleDouble
.LSOverride

.devspace
7 changes: 7 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,13 @@
},
"require-dev": {
"roave/security-advisories": "dev-master"
},
"scripts": {
"dev": [
"which devspace || yarn global add devspace || true",
"Composer\\Config::disableProcessTimeout",
"devspace sync --local-path=./src --container-path=/srv/cloud-screenshot/vendor/elegantthemes/hustle/src --initial-sync=preferLocal --upload-only --namespace=dc-screenshot"
]
}
}

17 changes: 17 additions & 0 deletions devspace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: v1beta9
deployments:
- name: cloud-screenshot
helm:
chart:
name: ../../../devops/helm-charts/charts/cloud-screenshot
dev:
sync:
- namespace: dc-screenshot
initialSync: preferLocal
labelSelector:
app: cloud-screenshot
localSubPath: ./src
containerPath: /srv/cloud-screenshot/vendor/elegantthemes/hustle/src
excludePaths:
- node_modules/
- .env
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public function __construct( string $name = 'default', array $redis_nodes = [] )
// Redis Cluster
ini_set( 'redis.clusters.cache_slots', 1 );

self::$_DB = new RedisCluster( null, $redis_nodes, 1.5, 0 );
self::$_DB = new RedisCluster( null, $redis_nodes, 1.5, 900 );

self::$_DB->setOption( RedisCluster::OPT_SLAVE_FAILOVER, RedisCluster::FAILOVER_DISTRIBUTE );

Expand Down
7 changes: 5 additions & 2 deletions src/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,11 @@ public function put( callable $run, array $data ): string {
}

public function take(): Job {
$job_id = self::$_DB->brpoplpush( $this->__pending(), $this->__running(), 600 );
$job = Job::instance( $this->name, $job_id );
while ( ! $job_id = self::$_DB->brpoplpush( $this->__pending(), $this->__running(), 600 ) ) {
sleep(1 );
}

$job = Job::instance( $this->name, $job_id );

$job->status = 'running';

Expand Down

0 comments on commit b524809

Please sign in to comment.