Create generic backend process, fix background interdependencies
This refactor was born out of the inter-dependency cycles developing between the "background" module and just about every other module which was caused by the background module becoming a dependency of every module that needed to background work and the fact that the background module was also supposedly responsible for the logic for processing those tasks. Instead the "background" module is now very, very shallow and relies entirely on the Postgres NOTIFY logic for triggering jobs. There's a new table, `job` which holds just a type and single row ID. All told, this means that jobs can be added to the queue as part of the API-level or platform-level transaction, ensuring atomicity, and processing coordination is handled by the platform module, which can depend on anything.
This commit is contained in:
parent
3a28151b09
commit
2538638c9d
47 changed files with 1553 additions and 1054 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"github.com/Gleipnir-Technology/nidus-sync/platform"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/platform/report"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/platform/text"
|
||||
"github.com/Gleipnir-Technology/nidus-sync/platform/types"
|
||||
"github.com/rs/zerolog/log"
|
||||
)
|
||||
|
||||
|
|
@ -26,7 +27,7 @@ func postRegisterNotifications(w http.ResponseWriter, r *http.Request) {
|
|||
phone_str := r.PostFormValue("phone")
|
||||
report_id := r.PostFormValue("report_id")
|
||||
|
||||
var phone *text.E164
|
||||
var phone *types.E164
|
||||
if phone_str != "" {
|
||||
phone, err = text.ParsePhoneNumber(phone_str)
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue