diff --git a/client_options.go b/client_options.go index 9c75fbe0..03a870b4 100644 --- a/client_options.go +++ b/client_options.go @@ -110,7 +110,6 @@ func defaultClientOptions() *clientOptions { ModelDraftTransaction.String() + "_clean_up": taskIntervalDraftCleanup, ModelIncomingTransaction.String() + "_process": taskIntervalProcessIncomingTxs, ModelSyncTransaction.String() + "_" + syncActionBroadcast: taskIntervalSyncActionBroadcast, - ModelSyncTransaction.String() + "_" + syncActionP2P: taskIntervalSyncActionP2P, ModelSyncTransaction.String() + "_" + syncActionSync: taskIntervalSyncActionSync, ModelTransaction.String() + "_" + TransactionActionCheck: taskIntervalTransactionCheck, }, diff --git a/definitions.go b/definitions.go index 73931ccf..0c70e7e5 100644 --- a/definitions.go +++ b/definitions.go @@ -34,7 +34,6 @@ const ( taskIntervalMonitorCheck = defaultMonitorHeartbeat * time.Second // Default task time for cron jobs (seconds) taskIntervalProcessIncomingTxs = 30 * time.Second // Default task time for cron jobs (seconds) taskIntervalSyncActionBroadcast = 30 * time.Second // Default task time for cron jobs (seconds) - taskIntervalSyncActionP2P = 35 * time.Second // Default task time for cron jobs (seconds) taskIntervalSyncActionSync = 40 * time.Second // Default task time for cron jobs (seconds) taskIntervalTransactionCheck = 60 * time.Second // Default task time for cron jobs (seconds) ) diff --git a/model_sync_transactions.go b/model_sync_transactions.go index 0a2c2904..5232c651 100644 --- a/model_sync_transactions.go +++ b/model_sync_transactions.go @@ -143,6 +143,7 @@ func (m *SyncTransaction) RegisterTasks() error { return nil } + // Sync with chain - task // Register the task locally (cron task - set the defaults) syncTask := m.Name() + "_" + syncActionSync ctx := context.Background() @@ -171,6 +172,7 @@ func (m *SyncTransaction) RegisterTasks() error { return err } + // Broadcast - task // Register the task locally (cron task - set the defaults) broadcastTask := m.Name() + "_" + syncActionBroadcast @@ -197,27 +199,5 @@ func (m *SyncTransaction) RegisterTasks() error { return err } - // Register the task locally (cron task - set the defaults) - p2pTask := m.Name() + "_" + syncActionP2P - - // Register the task - if err = tm.RegisterTask(&taskmanager.Task{ - Name: p2pTask, - RetryLimit: 1, - Handler: func(client ClientInterface) error { - if taskErr := taskNotifyP2P(ctx, client.Logger(), WithClient(client)); taskErr != nil { - client.Logger().Error(ctx, "error running "+p2pTask+" task: "+taskErr.Error()) - } - return nil - }, - }); err != nil { - return err - } - - // Run the task periodically - return tm.RunTask(ctx, &taskmanager.TaskOptions{ - Arguments: []interface{}{m.Client()}, - RunEveryPeriod: m.Client().GetTaskPeriod(p2pTask), - TaskName: p2pTask, - }) + return nil } diff --git a/sync_tx_service.go b/sync_tx_service.go index 939e1d86..c11a20c9 100644 --- a/sync_tx_service.go +++ b/sync_tx_service.go @@ -96,37 +96,6 @@ func processBroadcastTransactions(ctx context.Context, maxTransactions int, opts return nil } -// processP2PTransactions will process transactions for p2p notifications -func processP2PTransactions(ctx context.Context, maxTransactions int, opts ...ModelOps) error { - queryParams := &datastore.QueryParams{ - Page: 1, - PageSize: maxTransactions, - OrderByField: "created_at", - SortDirection: "asc", - } - - // Get x records - records, err := getTransactionsToNotifyP2P( - ctx, queryParams, opts..., - ) - if err != nil { - return err - } else if len(records) == 0 { - return nil - } - - // Process the incoming transaction - for index := range records { - if err = processP2PTransaction( - ctx, records[index], nil, - ); err != nil { - return err - } - } - - return nil -} - // broadcastSyncTransaction will broadcast transaction related to syncTx record func broadcastSyncTransaction(ctx context.Context, syncTx *SyncTransaction) error { // Successfully capture any panics, convert to readable string and log the error diff --git a/tasks.go b/tasks.go index dd771f4a..10c29beb 100644 --- a/tasks.go +++ b/tasks.go @@ -79,18 +79,6 @@ func taskBroadcastTransactions(ctx context.Context, logClient zLogger.GormLogger return err } -// taskNotifyP2P will notify any p2p paymail providers -func taskNotifyP2P(ctx context.Context, logClient zLogger.GormLoggerInterface, opts ...ModelOps) error { - - logClient.Info(ctx, "running notify p2p paymail provider(s) task...") - - err := processP2PTransactions(ctx, 10, opts...) - if err == nil || errors.Is(err, datastore.ErrNoResults) { - return nil - } - return err -} - // taskSyncTransactions will sync any transactions func taskSyncTransactions(ctx context.Context, logClient zLogger.GormLoggerInterface, opts ...ModelOps) error {