-
Notifications
You must be signed in to change notification settings - Fork 2
Use updated simplified SDK flow #14
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
base: main
Are you sure you want to change the base?
Conversation
| // Run starts the appchain with the given config. Exported for testing. | ||
| func Run(ctx context.Context, cfg *gosdk.InitConfig) error { | ||
| // Add custom tables to config | ||
| cfg.CustomTables = application.Tables() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In future we need to change it, like adding a method RegisterTables or something
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay
| } | ||
|
|
||
| // Run appchain in goroutine | ||
| runErr := make(chan error, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whats about graceful shutdown in the uodated version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signal.NotifyContext above still handles that, It will cancel the ctx
runErr chan was never actually read
Now graceful shutdown is handled via ctx propagation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, it's not a magic thing. you have to have select that listens the context and run the app in a goroutine to make it work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a select inside Run which is listening to ctx in loop, Will that not work ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me update, Got it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check now, I have added for app and rpc both
| select { | ||
| case <-ctx.Done(): | ||
| // nothing to do | ||
| case runErr <- appchainExample.Run(ctx): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we removed that and made the app blocking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me add stop() when appchain crashes, Rest cases are handled by ctx propagation
|
|
||
| // craft os.Args for main() | ||
| oldArgs := os.Args | ||
| require.NoError(t, os.MkdirAll(txBatchPath, 0o755)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need to create them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think yes because in actual pelacli creates them and appchain just consume
txBatch, events and multichain
only txpool and appchainDB is created by appchain
| @@ -1,48 +1,34 @@ | |||
| services: | |||
| pelacli: | |||
| container_name: pelacli | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is cluster working fine? Transactions, their status?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean cluster with example and pelacli ? Or the core cluster ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you are asking about local cluster with example, pelacli and explorer
It's working fine
Just need to update pelacli with latest sdk once core is done
|
|
||
| appchainExample := gosdk.NewAppchain( | ||
| stateTransition, | ||
| defer appInit.Close() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it intersect with dbs that appchain closes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes both close storage object but in our example we have not used appchain.close
We can remove storage.close from appchain.close in sdk
Code Metrics Report
Details | | #14 (818c750) | #14 (5c69771) | +/- |
|---------------------|---------------|---------------|-------|
- | Coverage | 25.2% | 25.2% | -0.1% |
| Files | 11 | 11 | 0 |
| Lines | 336 | 337 | +1 |
| Covered | 85 | 85 | 0 |
| Test Execution Time | 2s | 2s | 0s |Code coverage of files in pull request scope (11.4% → 11.4%)
Reported by octocov |
No description provided.