* feat: add tryEnqueue function.
tryEnqueue tries to enqueue a job to the given job channel. Returns true if
the operation was successful, and false if enqueuing would not have been
possible without blocking. Job is not enqueued in the latter case.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* remove inital worker
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Currently the notification, if a sound is specified, will be converted into a critical notification. This behaviour occurs because the sideshow/apns2 package initializes a new sound-dict on `payload.SoundName()` and inserts the name into it. If the sound-key is specified as a dictionary, the alert will be seen as a critical alert according to the documentation [developer.apple.com/documentation/usernotifications](https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/generating_a_remote_notification#2943363).
In order to prevent the notification to get a critical one by specifying a sound, the sound name from the rest-API needs to be set as string to the sound-property of the payload for apns. This can be achieved by setting either the sound-key from the request to the sound property of the payload if it is a string or by setting the soundname-key from the request to the sound property without the usage of `payload.SoundName()`. For more consistency to the documentation, this pull request implements the variant, that the sound-key from the request is set as string into the sound-property of the apns-payload.
It was [not obvious](https://github.com/appleboy/gorush/issues/391) that I should specify `platform=2 (Android)` if I want to send notifications on both Android and iOS devices using Firebase, so here are some changes in documentation. Thanks!
The PushNotification object is quite big (772 bytes on AMD64),
so avoid doing too many copying without a need.
Collect pointers and do copying only when sending into a channel.
Found using https://go-critic.github.io/overview#rangeValCopy-ref
Linter output:
```
$GOPATH/src/github.com/appleboy/gorush/gorush/worker.go:38:2: rangeValCopy: each iteration copies 772 bytes (consider pointers or indexing)
$GOPATH/src/github.com/appleboy/gorush/gorush/worker.go:53:2: rangeValCopy: each iteration copies 772 bytes (consider pointers or indexing)
```
This patch simply adds `openbsd` to `TARGETS`. This is a supported Go architecture and the result will be binaries that can be run on 32 or 64-bit OpenBSD.
This project is hard to build on OpenBSD because it depends on some Linux-isms like *GNU Make* and specific `find` options. So it will be nice to have binaries easily available.