Merge pull request 'refs #8886 fix slowness' (!141) from test into master
gitea/hedera-web/pipeline/head This commit looks good Details

Reviewed-on: #141
This commit is contained in:
Juan Ferrer 2025-04-08 11:48:57 +00:00
commit e9b6c67ac9
5 changed files with 44 additions and 35 deletions

View File

@ -1,17 +1,11 @@
# Not using buster because of bug: https://bugs.php.net/bug.php?id=78870
FROM debian:bookworm-slim
FROM registry.verdnatura.es/verdnatura/node:20.18.3-vn1
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
curl \
ca-certificates \
gnupg2
# Apache
RUN apt-get install -y --no-install-recommends \
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
apache2 \
libapache2-mod-php \
&& . /etc/apache2/envvars \
@ -21,14 +15,9 @@ RUN apt-get install -y --no-install-recommends \
RUN a2dissite 000-default
# NodeJs
RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \
&& apt-get install -y --no-install-recommends nodejs
# Hedera
RUN curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | tee /etc/apt/trusted.gpg.d/verdnatura.gpg \
RUN curl -sL https://apt.verdnatura.es/conf/verdnatura.gpg | apt-key add - \
&& echo "deb http://apt.verdnatura.es/ bookworm main" \
> /etc/apt/sources.list.d/vn.list \
&& apt-get update \

28
Jenkinsfile vendored
View File

@ -1,8 +1,12 @@
#!/usr/bin/env groovy
def PROTECTED_BRANCH
def RUN_BUILD
def BRANCH_ENV = [
test: 'test',
master: 'production'
master: 'production',
beta: 'test'
]
def remote = [:]
@ -10,6 +14,15 @@ node {
stage('Setup') {
env.NODE_ENV = BRANCH_ENV[env.BRANCH_NAME] ?: 'dev'
PROTECTED_BRANCH = [
'dev',
'test',
'master',
'beta'
].contains(env.BRANCH_NAME)
RUN_BUILD = PROTECTED_BRANCH
echo "NODE_NAME: ${env.NODE_NAME}"
echo "WORKSPACE: ${env.WORKSPACE}"
}
@ -22,20 +35,18 @@ pipeline {
stages {
stage('Debuild') {
when {
anyOf {
branch 'master'
branch 'test'
}
expression { PROTECTED_BRANCH }
}
agent {
docker {
image 'registry.verdnatura.es/verdnatura/debuild:2.23.4-vn7'
image 'registry.verdnatura.es/verdnatura/debuild:2.23.4-vn9'
registryUrl 'https://registry.verdnatura.es/'
registryCredentialsId 'docker-registry'
}
}
steps {
sh 'debuild -us -uc -b'
sh 'rm -rf debuild'
sh 'mkdir -p debuild'
sh 'mv ../hedera-web_* debuild'
@ -55,10 +66,7 @@ pipeline {
}
stage('Deploy') {
when {
anyOf {
branch 'master'
branch 'test'
}
expression { PROTECTED_BRANCH }
}
environment {
CREDS = credentials('docker-registry')

2
debian/changelog vendored
View File

@ -1,4 +1,4 @@
hedera-web (25.4.4) stable; urgency=low
hedera-web (25.14.1) stable; urgency=low
* Initial Release.

View File

@ -1,6 +1,6 @@
{
"name": "hedera-web",
"version": "25.4.4",
"version": "25.14.1",
"description": "Verdnatura web page",
"license": "GPL-3.0",
"repository": {

View File

@ -3,6 +3,7 @@
namespace Vn\Web;
class DbSessionHandler implements \SessionHandlerInterface {
const UPDATE_INTERVAL = 30;
private $db;
function __construct($db) {
@ -24,12 +25,23 @@ class DbSessionHandler implements \SessionHandlerInterface {
}
function write($sessionId, $sessionData) {
$this->db->query(
'INSERT INTO userSession SET
ssid = #, data = #, lastUpdate = NOW()
ON DUPLICATE KEY UPDATE
data = VALUES(data), lastUpdate = VALUES(lastUpdate)',
[$sessionId, $sessionData]);
$session = $this->db->getObject(
'SELECT data, lastUpdate < (NOW() - INTERVAL # SECOND) hasToRefresh
FROM userSession WHERE ssid = #',
[self::UPDATE_INTERVAL, $sessionId]
);
if (!isset($session)
|| $sessionData !== $session->data
|| $session->hasToRefresh) {
$this->db->query(
'INSERT INTO userSession SET
ssid = #, data = #, lastUpdate = NOW()
ON DUPLICATE KEY UPDATE
data = VALUES(data), lastUpdate = VALUES(lastUpdate)',
[$sessionId, $sessionData]);
}
return TRUE;
}
@ -40,8 +52,8 @@ class DbSessionHandler implements \SessionHandlerInterface {
function gc($maxLifeTime) {
$this->db->query('DELETE FROM userSession
WHERE lastUpdate < TIMESTAMPADD(SECOND, -#, NOW())',
[$maxLifeTime]
WHERE lastUpdate < (NOW() - INTERVAL # SECOND)',
[$maxLifeTime + self::UPDATE_INTERVAL + 1]
);
return TRUE;
}