( ctx context.Context, tx sqlplugin.Tx, shardID int32, timerTasks []p.InternalHistoryTask, )
| 827 | } |
| 828 | |
| 829 | func createTimerTasks( |
| 830 | ctx context.Context, |
| 831 | tx sqlplugin.Tx, |
| 832 | shardID int32, |
| 833 | timerTasks []p.InternalHistoryTask, |
| 834 | ) error { |
| 835 | |
| 836 | if len(timerTasks) == 0 { |
| 837 | return nil |
| 838 | } |
| 839 | |
| 840 | timerTasksRows := make([]sqlplugin.TimerTasksRow, 0, len(timerTasks)) |
| 841 | for _, task := range timerTasks { |
| 842 | timerTasksRows = append(timerTasksRows, sqlplugin.TimerTasksRow{ |
| 843 | ShardID: shardID, |
| 844 | VisibilityTimestamp: task.Key.FireTime, |
| 845 | TaskID: task.Key.TaskID, |
| 846 | Data: task.Blob.Data, |
| 847 | DataEncoding: task.Blob.EncodingType.String(), |
| 848 | }) |
| 849 | } |
| 850 | |
| 851 | result, err := tx.InsertIntoTimerTasks(ctx, timerTasksRows) |
| 852 | if err != nil { |
| 853 | return serviceerror.NewUnavailablef("createTimerTasks failed. Error: %v", err) |
| 854 | } |
| 855 | rowsAffected, err := result.RowsAffected() |
| 856 | if err != nil { |
| 857 | return serviceerror.NewUnavailablef("createTimerTasks failed. Could not verify number of rows inserted. Error: %v", err) |
| 858 | } |
| 859 | |
| 860 | if int(rowsAffected) != len(timerTasks) { |
| 861 | return serviceerror.NewUnavailablef("createTimerTasks failed. Inserted %v instead of %v rows into timer_tasks. Error: %v", rowsAffected, len(timerTasks), err) |
| 862 | } |
| 863 | return nil |
| 864 | } |
| 865 | |
| 866 | func createReplicationTasks( |
| 867 | ctx context.Context, |
no test coverage detected