Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert: fetching jobs/collections from cache #1198

Merged
merged 4 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ jobs:
golangci-lint run -v --timeout 5m
- name: Execute test case
run: |
go-acc ./... --ignore razor/accounts/mocks --ignore razor/cmd/mocks --ignore razor/cmd/eventListeners.go --ignore razor/utils/mocks --ignore pkg --ignore razor/path/mocks --output coverage.txt
go-acc ./... --ignore razor/accounts/mocks --ignore razor/cmd/mocks --ignore razor/utils/mocks --ignore pkg --ignore razor/path/mocks --output coverage.txt
- name: Run benchmarks
run: |
go test ./... -bench=. -run=^#
Expand Down
34 changes: 0 additions & 34 deletions cache/collectionCache.go

This file was deleted.

34 changes: 0 additions & 34 deletions cache/jobCache.go

This file was deleted.

204 changes: 0 additions & 204 deletions cmd/eventListeners.go

This file was deleted.

1 change: 0 additions & 1 deletion cmd/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,6 @@ type UtilsCmdInterface interface {
ResetDispute(client *ethclient.Client, blockManager *bindings.BlockManager, txnOpts *bind.TransactOpts, epoch uint32)
StoreBountyId(client *ethclient.Client, account types.Account) error
CheckToDoResetDispute(client *ethclient.Client, blockManager *bindings.BlockManager, txnOpts *bind.TransactOpts, epoch uint32, sortedValues []*big.Int)
InitAssetCache(client *ethclient.Client) error
}

type TransactionInterface interface {
Expand Down
14 changes: 0 additions & 14 deletions cmd/mocks/utils_cmd_interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions cmd/vote.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,6 @@ func (*UtilsStruct) ExecuteVote(flagSet *pflag.FlagSet) {
account := types.Account{Address: address, Password: password}

cmdUtils.HandleExit()

err = cmdUtils.InitAssetCache(client)
utils.CheckError("Error in initializing asset cache: ", err)

go utils.HandleResetCache(client, config.BufferPercent)

log.Debugf("Calling Vote() with arguments rogueData = %+v, account address = %s, backup node actions to ignore = %s", rogueData, account.Address, backupNodeActionsToIgnore)
if err := cmdUtils.Vote(context.Background(), config, client, rogueData, account, backupNodeActionsToIgnore); err != nil {
log.Errorf("%v\n", err)
Expand Down
34 changes: 10 additions & 24 deletions cmd/vote_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,16 @@ func TestExecuteVote(t *testing.T) {
var config types.Configurations

type args struct {
config types.Configurations
configErr error
password string
rogueStatus bool
rogueErr error
rogueMode []string
rogueModeErr error
address string
addressErr error
initAssetCacheErr error
voteErr error
config types.Configurations
configErr error
password string
rogueStatus bool
rogueErr error
rogueMode []string
rogueModeErr error
address string
addressErr error
voteErr error
}
tests := []struct {
name string
Expand Down Expand Up @@ -116,18 +115,6 @@ func TestExecuteVote(t *testing.T) {
},
expectedFatal: false,
},
{
name: "Test 7: When there is an error in initializing cache",
args: args{
config: config,
password: "test",
address: "0x000000000000000000000000000000000000dea1",
rogueStatus: true,
rogueMode: []string{},
initAssetCacheErr: errors.New("initAssetCache error"),
},
expectedFatal: true,
},
}

defer func() { log.ExitFunc = nil }()
Expand All @@ -147,7 +134,6 @@ func TestExecuteVote(t *testing.T) {
utilsMock.On("ConnectToClient", mock.AnythingOfType("string")).Return(client)
flagSetMock.On("GetBoolRogue", mock.AnythingOfType("*pflag.FlagSet")).Return(tt.args.rogueStatus, tt.args.rogueErr)
flagSetMock.On("GetStringSliceRogueMode", mock.AnythingOfType("*pflag.FlagSet")).Return(tt.args.rogueMode, tt.args.rogueModeErr)
cmdUtilsMock.On("InitAssetCache", mock.Anything).Return(tt.args.initAssetCacheErr)
cmdUtilsMock.On("HandleExit").Return()
cmdUtilsMock.On("Vote", mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything, mock.Anything).Return(tt.args.voteErr)
osMock.On("Exit", mock.AnythingOfType("int")).Return()
Expand Down
5 changes: 0 additions & 5 deletions core/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,3 @@ var HexArrayExtractIndexRegex = `^hexArray\[(\d+)\]$`
var BatchSize = 1000
var NumRoutines = 10
var MaxIterations = 10000000

// Following are the constants which determine storing jobs and collections value for time being in cache

var AssetUpdateListenerInterval = 10
var AssetCacheExpiry = 5 * EpochLength
Loading
Loading