Skip to content

Commit

Permalink
LDEV-4406 - improve mail watcher itself
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Dec 18, 2023
1 parent f98aab0 commit 2c961ee
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
14 changes: 11 additions & 3 deletions core/src/main/cfml/context/gateway/MailWatcher.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@

public void function start() output=false localmode=true {

while ( getState() EQ "stopping" ) {
if ( getState() EQ "stopping" ) {
sleep(10);
}
variables.state="running";
writeLog ( text="start", file=variables.logFile, type="information" );
var last =now();
var mail = "";

while ( variables.state EQ "running" ){
while ( variables.state EQ "running" ) {
try {
mails = getMailsNewerThan( config.server, config.port, config.username, config.password, config.attachmentpath, last);
for ( el in mails ) {
Expand All @@ -52,8 +52,10 @@
if ( getState() != "running" ) {
break;
}
sleep( variables.config.interval );
sleep( variables.config.interval?:10 );
}
// set to stopped when we leave
variables.setState( "stopped" );
}

public array function getMailsNewerThan( required string server, required numeric port, required string user, required string pass,
Expand Down Expand Up @@ -86,6 +88,12 @@
public void function stop() output=false {
writeLog ( text="stop", file="MailWatcher", type="information" );
variables.state="stopping";

sleep( (variables.config.interval?:10)+10 );
// should be stopped, so we guess it is blockes somehow, because it will not run again, we can ignore it
if (getState() EQ "stopping" ) {
variables.state="stopping";
}
}

public void function restart() output=false {
Expand Down
2 changes: 1 addition & 1 deletion loader/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<project default="core" basedir="." name="Lucee"
xmlns:resolver="antlib:org.apache.maven.resolver.ant">

<property name="version" value="6.0.1.43-SNAPSHOT"/>
<property name="version" value="6.0.1.44-SNAPSHOT"/>

<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml">
<classpath>
Expand Down
2 changes: 1 addition & 1 deletion loader/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<groupId>org.lucee</groupId>
<artifactId>lucee</artifactId>
<version>6.0.1.43-SNAPSHOT</version>
<version>6.0.1.44-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Lucee Loader Build</name>
Expand Down

0 comments on commit 2c961ee

Please sign in to comment.