Skip to content

Commit

Permalink
revert: fetching jobs/collections from cache (#1198)
Browse files Browse the repository at this point in the history
* Revert "fix: incorrect state error for shorter epoch length (#1192)"

* Revert "feat: caching jobs and collections (#1183)"

* fix: updated default config value changes considering 5 min epoch

* refactor: recorrected log according to new buffer default 0 value
  • Loading branch information
Yashk767 committed Mar 22, 2024
1 parent 2fd96c8 commit 5ae7e15
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 613 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/develop.yml
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
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
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
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
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

0 comments on commit 5ae7e15

Please sign in to comment.