Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2afa768

Browse files
authored
Fix for issue#196 (#197)
1 parenteaa39a1 commit2afa768

File tree

1 file changed

+43
-14
lines changed

1 file changed

+43
-14
lines changed

‎main.js‎

Lines changed: 43 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ async function getAttachments(attachments) {
3737
returnfiles.map(f=>({filename:path.basename(f),path:f,cid:f.replace(/^.*[\\\/]/,'')}))
3838
}
3939

40+
functionsleep(ms){
41+
returnnewPromise((resolve)=>{
42+
setTimeout(resolve,ms);
43+
});
44+
}
45+
4046
asyncfunctionmain(){
4147
try{
4248
letserverAddress=core.getInput("server_address")
@@ -118,20 +124,43 @@ async function main() {
118124
debug:nodemailerdebug,
119125
})
120126

121-
constinfo=awaittransport.sendMail({
122-
from:getFrom(from,username),
123-
to:to,
124-
subject:getText(subject,false),
125-
cc:cc ?cc :undefined,
126-
bcc:bcc ?bcc :undefined,
127-
replyTo:replyTo ?replyTo :undefined,
128-
inReplyTo:inReplyTo ?inReplyTo :undefined,
129-
references:inReplyTo ?inReplyTo :undefined,
130-
text:body ?getText(body,false) :undefined,
131-
html:htmlBody ?getText(htmlBody,convertMarkdown) :undefined,
132-
priority:priority ?priority :undefined,
133-
attachments:attachments ?(awaitgetAttachments(attachments)) :undefined,
134-
})
127+
vari=1;
128+
while(true){
129+
try{
130+
constinfo=awaittransport.sendMail({
131+
from:getFrom(from,username),
132+
to:to,
133+
subject:getText(subject,false),
134+
cc:cc ?cc :undefined,
135+
bcc:bcc ?bcc :undefined,
136+
replyTo:replyTo ?replyTo :undefined,
137+
inReplyTo:inReplyTo ?inReplyTo :undefined,
138+
references:inReplyTo ?inReplyTo :undefined,
139+
text:body ?getText(body,false) :undefined,
140+
html:htmlBody ?getText(htmlBody,convertMarkdown) :undefined,
141+
priority:priority ?priority :undefined,
142+
attachments:attachments ?(awaitgetAttachments(attachments)) :undefined,
143+
});
144+
break;
145+
}catch(error){
146+
if(!error.message.includes("Try again later,")){
147+
core.setFailed(error.message)
148+
break;
149+
}
150+
if(i>10){
151+
core.setFailed(error.message)
152+
break;
153+
}
154+
console.log("Received: "+error.message);
155+
if(i<2){
156+
console.log("Trying again in a minute...");
157+
}else{
158+
console.log("Trying again in "+i+" minutes...");
159+
}
160+
awaitsleep(i*60000);
161+
i++;
162+
}
163+
}
135164
}catch(error){
136165
core.setFailed(error.message)
137166
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp