4d / 4D-Mobile-App-Server

Open sourced component to install to 4d server as mobile app back end
Other
6 stars 7 forks source link

SendAll sets success to true even if there are warnings and errors #6

Open macMikey opened 2 years ago

macMikey commented 2 years ago

Sometime after b27545ffb08b684f7212f869f04e000d868e1ed3 (I have not read through the code to see where, yet), push .sendAll can both set success to true while returning both errors and warnings, and the notification failing.

macMikey commented 2 years ago

In 19.1, everything works as expected. In 18R4, no.

mesopelagique commented 2 years ago

I will try to analyse the code (not mine)

If there is some issue with email or token passed warning could occurs https://github.com/4d-go-mobile/4D-Mobile-App-Server/blob/main/Project/Sources/Methods/Mobile%20App%20Push%20Notification.4dm#L57 but we go on

then if one push has been sent with success I see that success is set to True and warning are added for failures https://github.com/4d-go-mobile/4D-Mobile-App-Server/blob/main/Project/Sources/Methods/Mobile%20App%20Push%20Notification.4dm#L113 comments see a choice have been made to do that

(have different behaviour could be discussed, like stop at first failure, or set False if one failure, maybe return all result for each notification!)

macMikey commented 2 years ago

I saw that in the code, that success is supposed to mean that at least one message makes it through, but what I experienced was that even if all fail (which is what I was finding, because my session filenames were not email addresses), I can get a success. Since R4 compiled isn't behaving the same as interpreted, or at least as what's at the R4 tag in the repo, I can't reproduce the behavior in interpreted and offer some assistance in diagnosing it. Maybe warning should be for messages that 4D transmits but only after it had to fix something, like discarding the badge because it was not a number. I don't think APNS will accept any malformed messages.

mesopelagique commented 2 years ago

My first analyse was limited to Mobile App Push Notification, and suppose that next command do the job correctly

This method call apple_sendNotification that return success if the call of LAUNCH EXTERNAL PROCESS with curl has no output https://github.com/4d-go-mobile/4D-Mobile-App-Server/blob/main/Project/Sources/Methods/apple_sendNotification.4dm#L53 (4D do not return process exit code with LAUNCH EXTERNAL PROCESS, so it's a little tricky) I will ask about it

(maybe it a change in option like --verbose or curl behaviour change , maybe loging $cmdPush and launching the command in internal could help, see if error are in system out or in system err)