It is currently 21 April 2025, 18:33 Advanced search

Timer in Test server has a strange behaviour

Questions and answers on how to best use Instant Developer

Timer in Test server has a strange behaviour

Postby kath velasco » 20 February 2025, 10:31

Gentilissimi,
vorrei chiedere una spiegazione per quanto riguarda il comportamento del nostro applicativo web.
In pratica ho questi elementi che si occupano alla gestione del timer.
Timer è abilitato, è server session ed è anche permanente che scatta ogni 1 minuto.
Tale elemento è attivato da una procedura "timer" che esegue un blocco di codice solo se si è in produzione. Quindi al suo interno vi è un ifelse.
    1) if in produzione allora esegui il codice: chiami le funzioni update start time e update end time. Queste vanno a eseguire l'aggiornamento dei valori della tabella di timer, rispettivamente il valore di inizio scatto e quello di ultimo scatto.
    2) ELSE scrivi un testo test sul file log.txt.
NB. Ho verificato chi usa updateStartTime e updateEndTime e c'è solo la procedura Timer. Invece la procedura Timer è solo usato dall'elemento timer.
Il mio problema sorge nel momento in cui avvio il progetto in Test, i dati di ultimo e inizio scatto vengono aggiornati. Quindi sembrerebbe che in test il programma esegui l'aggiornamento anche se non dovrebbe.
Ho provato a capire il problema
    1) Ho verificato chi usa la tabella timer e ho trovato sono solo quelle tre procedure : Timer, updateStartTime e updateEndTime.
    2)Ho controllato il log.txt e effettivamente c'è il testo che mi da conferma che il sistema abbia eseguito l'else della procedura Timer senza entrare nell'if.
    3)Dentro update end time ho provato a commentare il codice che aggiorna il valore ultimo scatto e poi al suo posto ho messo un codice che scrive sul log.txt. Per vedere se va veramente ad eseguire le procedura. Ma lo stesso ad ogni scatto del Timer i valore di inizio e ultimo scatto si aggiornano e sul mio log.txt non ho trovato il testo che mi attesti che la procedura update end timer sia stata eseguita.
    4) ho provato a pulire la memoria cache, ma nulla è cambiato: scatta e va a modificare lo stesso

Non capisco come mai il web app in TEST, esegua l'aggiornamento dei valori della tabella anche se non dovrebbe. Ho provato con diversi controlli con log.txt ma non sono riuscita a capire il mistero.
Come se nella videata del timer, l'elemento Timer scatti e automaticamente modifica i dati.
Questo risulta molto strano anche perche in LOCALE l'errore non appare.
Esiste un modo per capire meglio il perche i dati vengono aggiornati in test?
Attachments
Cattura.JPG
Cattura.JPG (15.47 KiB) Viewed 604 times
Last edited by kath velasco on 24 February 2025, 9:30, edited 1 time in total.
kath velasco
 
Posts: 20
Joined: 26 September 2024, 12:29

Re: Timer in Test perche si comporta strano?

Postby ljwilson » 22 February 2025, 14:14

Stai chiedendo nel forum inglese, potresti ottenere più risposte postando nel forum italiano.

So che quando abbiamo iniziato a usare i timer per le sessioni, a volte ottenevamo più istanze di timer dello stesso timer in funzione. La mia teoria era che il timer a volte era in esecuzione sia nella sessione che nell'app principale. Quindi quello che facciamo ora è deselezionare la casella abilitata sul timer stesso, quindi nell'evento di inizializzazione dell'app, controlliamo se siamo in una sessione (myapp.sessionname != "") e in tal caso impostiamo il timer su abilitato. Lasciamo comunque la casella sul timer selezionata per la sessione del server.

L'altro pensiero è cosa pensi determini se la produzione o il test o il locale non stanno facendo quello che pensi che facciano.

...jack
ljwilson
 
Posts: 783
Joined: 26 November 2013, 14:15

Re: Timer in Test perche si comporta strano?

Postby kath velasco » 24 February 2025, 9:27

I'm sorry for my inattentiveness, thank you anyway for pointing it out to me.
I tried to disabled the timer in test but i got the same results.
The point is i tried in different ways to understand what is really happening and why the timer is being activated and why the table timer are updated.
I also tried to comment out all the blocks of code that is inside the procedure timer but still nothing, the table timer is being updated.
kath velasco
 
Posts: 20
Joined: 26 September 2024, 12:29

Re: Timer in Test perche si comporta strano?

Postby kath velasco » 24 February 2025, 9:30

Hello,
I would like to ask for an explanation regarding the behavior of our web application.

I have these elements that manage the timer. The timer is enabled, it is a server session, and it is also permanent, triggering every minute. This element is activated by a "timer" procedure that executes a block of code only if we are in production. So, within it, there is an if-else statement:

If in production: execute the code; call the functions updateStartTime and updateEndTime. These functions update the values in the timer table, specifically the start time and the last trigger time.
Else: write a test message to the log.txt file.
Note: I have verified who uses updateStartTime and updateEndTime, and they are only used by the Timer procedure. The Timer procedure is only used by the timer element.

My problem arises when I run the project in Test; the last and start trigger times are updated. It seems that in Test, the program is executing the update even though it shouldn't.

I tried to understand the problem:

I checked who uses the timer table and found that only those three procedures are involved: Timer, updateStartTime, and updateEndTime.
I checked log.txt, and indeed, there is a message confirming that the system executed the else part of the Timer procedure without entering the if statement.
Inside updateEndTime, I tried commenting out the code that updates the last trigger value and replaced it with code that writes to log.txt to see if it executes the procedure. However, at each timer trigger, the start and last trigger values still update, and I did not find the message in log.txt confirming that the updateEndTime procedure was executed.
I tried clearing the cache, but nothing changed: it still triggers and modifies the data.
I do not understand why the web app in TEST updates the values in the table even though it shouldn't. I have tried various checks with log.txt but have been unable to uncover the mystery. It’s as if the Timer element on the timer screen triggers and automatically modifies the data. This is very strange, especially since the error does not appear in LOCAL.
This is the english version of my question
kath velasco
 
Posts: 20
Joined: 26 September 2024, 12:29


Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 12 guests

cron