mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-20 22:50:38 +00:00
Fix running without neon storage
This commit is contained in:
@@ -10,11 +10,11 @@ pub struct CommunicatorWorkerProcessStruct {
|
||||
}
|
||||
|
||||
pub(super) async fn init(
|
||||
tenant_id: String,
|
||||
timeline_id: String,
|
||||
tenant_id: Option<&str>,
|
||||
timeline_id: Option<&str>,
|
||||
) -> CommunicatorWorkerProcessStruct {
|
||||
let _tenant_id = TenantId::from_str(&tenant_id).expect("invalid tenant ID");
|
||||
let _timeline_id = TimelineId::from_str(&timeline_id).expect("invalid timeline ID");
|
||||
let _tenant_id = tenant_id.map(|s| TenantId::from_str(s).expect("invalid tenant ID"));
|
||||
let _timeline_id = timeline_id.map(|s| TimelineId::from_str(s).expect("invalid timeline ID"));
|
||||
|
||||
CommunicatorWorkerProcessStruct {
|
||||
// metrics
|
||||
|
||||
@@ -15,8 +15,16 @@ pub extern "C" fn communicator_worker_process_launch(
|
||||
timeline_id: *const c_char,
|
||||
) -> &'static CommunicatorWorkerProcessStruct {
|
||||
// Convert the arguments into more convenient Rust types
|
||||
let tenant_id = unsafe { CStr::from_ptr(tenant_id) }.to_str().unwrap();
|
||||
let timeline_id = unsafe { CStr::from_ptr(timeline_id) }.to_str().unwrap();
|
||||
let tenant_id = if tenant_id.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(unsafe { CStr::from_ptr(tenant_id) }.to_str().unwrap())
|
||||
};
|
||||
let timeline_id = if timeline_id.is_null() {
|
||||
None
|
||||
} else {
|
||||
Some(unsafe { CStr::from_ptr(timeline_id) }.to_str().unwrap())
|
||||
};
|
||||
|
||||
let runtime = tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
@@ -25,8 +33,8 @@ pub extern "C" fn communicator_worker_process_launch(
|
||||
.unwrap();
|
||||
|
||||
let worker_struct = runtime.block_on(main_loop::init(
|
||||
tenant_id.to_string(),
|
||||
timeline_id.to_string(),
|
||||
tenant_id,
|
||||
timeline_id,
|
||||
));
|
||||
let worker_struct = Box::leak(Box::new(worker_struct));
|
||||
|
||||
|
||||
@@ -94,8 +94,9 @@ communicator_new_bgworker_main(Datum main_arg)
|
||||
logging = configure_logging();
|
||||
|
||||
proc_handle = communicator_worker_process_launch(
|
||||
neon_tenant,
|
||||
neon_timeline);
|
||||
neon_tenant[0] == '\0' ? NULL : neon_tenant,
|
||||
neon_timeline[0] == '\0' ? NULL : neon_timeline
|
||||
);
|
||||
|
||||
/* proc_handle is not currently used, but will be in the future */
|
||||
(void) proc_handle;
|
||||
|
||||
Reference in New Issue
Block a user