-
Notifications
You must be signed in to change notification settings - Fork 27
RSDK-11067: remove resource on alwaysrebuild #458
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -128,16 +128,14 @@ struct ModuleService::ServiceImpl : viam::module::v1::ModuleService::Service { | |
| stoppable->stop(); | ||
| } | ||
|
|
||
| manager->remove(cfg.resource_name()); | ||
|
|
||
| const std::shared_ptr<const ModelRegistration> reg = | ||
| Registry::get().lookup_model(cfg.name()); | ||
| Registry::get().lookup_model(cfg.api(), cfg.model()); | ||
|
|
||
| // TODO RSDK-11067 new resource gets constructed while old one is still alive. | ||
| if (reg) { | ||
| try { | ||
| const std::shared_ptr<Resource> resource = reg->construct_resource(deps, cfg); | ||
| manager->replace_one(cfg.resource_name(), resource); | ||
| std::shared_ptr<Resource> resource = reg->construct_resource(deps, cfg); | ||
| manager->replace_one(cfg.resource_name(), std::move(resource)); | ||
|
||
| } catch (const std::exception& exc) { | ||
| return grpc::Status(::grpc::INTERNAL, exc.what()); | ||
| } | ||
|
|
||
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 fail to look up the model registration here, I think you should return an error. It's a pretty strange state of affairs because the model was registered once, apparently, such that the object could be brought into existence (otherwise, what is being reconfigured?) but now that it is time to reconfigure by rebuilding, the registration is gone. That also would have made the error here obvious, rather than a silent misbehavior.
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 you're right, it was really confusing to debug