Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Q
question2answer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
outils
question2answer
Commits
306a9bec
Commit
306a9bec
authored
Aug 16, 2018
by
pupi1985
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Apply some early returns in function qa_mailing_perform_step()
parent
de02a7fc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
mailing.php
qa-include/app/mailing.php
+9
-4
No files found.
qa-include/app/mailing.php
View file @
306a9bec
...
...
@@ -63,7 +63,10 @@ function qa_mailing_perform_step()
$lastuserid
=
qa_opt
(
'mailing_last_userid'
);
if
(
strlen
(
$lastuserid
))
{
if
(
strlen
(
$lastuserid
)
==
0
)
{
return
;
}
$thistime
=
time
();
$lasttime
=
qa_opt
(
'mailing_last_timestamp'
);
$perminute
=
qa_opt
(
'mailing_per_minute'
);
...
...
@@ -75,7 +78,10 @@ function qa_mailing_perform_step()
$count
=
min
(
floor
((
$thistime
-
$lasttime
)
*
$perminute
/
60
),
100
);
// don't do more than 100 messages at a time
if
(
$count
>
0
)
{
if
(
$count
==
0
)
{
return
;
}
qa_opt
(
'mailing_last_timestamp'
,
$thistime
+
30
);
// prevents a parallel call to qa_mailing_perform_step() from sending messages, unless we're very unlucky with timing (poor man's mutex)
...
...
@@ -105,10 +111,9 @@ function qa_mailing_perform_step()
qa_opt
(
'mailing_last_timestamp'
,
$lasttime
+
$sentusers
*
60
/
$perminute
);
// can be floating point result, based on number of mails actually sent
}
else
}
else
{
qa_mailing_stop
();
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment