Commit d0a5877e authored by Dominik Hebeler's avatar Dominik Hebeler

fixed loop in useragents

parent 9c7cbea5
......@@ -62,8 +62,8 @@ RUN mkdir -p /run/php && \
(crontab -l ; echo "* * * * * php /html/artisan schedule:run >> /dev/null 2>&1") | crontab -
COPY config/nginx.conf /etc/nginx/nginx.conf
COPY config/nginx-default.conf /etc/nginx/conf.d/default.conf
RUN sed -i 's/fastcgi_pass phpfpm:9000;/fastcgi_pass localhost:9000;/g' /etc/nginx/conf.d/default.conf
COPY config/nginx-default.conf /etc/nginx/sites-available/default
RUN sed -i 's/fastcgi_pass phpfpm:9000;/fastcgi_pass localhost:9000;/g' /etc/nginx/sites-available/default
COPY --chown=root:www-data . /html
WORKDIR /html
......
......@@ -43,14 +43,16 @@ class SaveUseragents extends Command
$agent = null;
$now = Carbon::now('utc')->toDateTimeString();
while (($agent = Redis::lpop("useragents")) !== null) {
while (!empty(($agent = Redis::lpop("useragents")))) {
$newEntry = json_decode($agent, true);
$newEntry["created_at"] = $now;
$newEntry["updated_at"] = $now;
$agents[] = $newEntry;
}
\App\UserAgent::insert($agents);
if (!empty($agents)) {
\App\UserAgent::insert($agents);
}
// Delete old entries (older than 24h)
$expiration = Carbon::now('utc')->subDays(1);
......
......@@ -56,7 +56,7 @@ services:
volumes:
- .:/html
- ./config/nginx.conf:/etc/nginx/nginx.conf
- ./config/nginx-default-dev.conf:/etc/nginx/conf.d/default.conf
- ./config/nginx-default-dev.conf:/etc/nginx/sites-available/default
ports:
- "8080:80"
worker:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment