You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm glad that they started developing this library. I looked at the code and noticed that it lacks synchronization between servers. For example, pub/sub sends only within the server. For example, the ability to connect via useStorage('redis') so that it is possible to store all clients and indicate a process identifier to determine which clients are external or internal
This will reduce the number of clients on 1 server and distribute it across several clients. Or what it's called I don't remember
Additional information
Would you be willing to help implement this feature?
The text was updated successfully, but these errors were encountered:
asyncfunctionrequest<NameextendskeyofLocalClient,CallbackextendsLocalClient[Name]>(clientId: UUID,name: Name, ...params: Parameters<Callback>){if(!(awaitstorage.hasItem(`client:${clientId}`))){thrownewError("No found client remote");}if(!local[name]){thrownewError("No found call remote");}constid=randomUUID();returnnewPromise<ReturnType<Callback>>(async(resolve,reject)=>{consttimeout=setTimeout(()=>{reject("Request timeout");clear();},requestAutoTime);asyncfunctionclear(){awaitunwatch();awaitstorage.clear(`request:${id}`);awaitstorage.clear(`response:${id}`);}constunwatch=awaitstorage.watch(async(type,key)=>{if(key==`response:${id}`){constresponse=awaitstorage.getItem<|{error: string;data: null}|{error: null;data: ReturnType<Callback>;}>(key);if(!response)return;const{ error, data }=response;if(error){reject(error);}elseif(data){resolve(data);}else{reject("Request failed");}clearTimeout(timeout);clear();}});awaitstorage.setItem(`request:${id}`,{
clientId,
name,
params,});});}
I found old code, and of course the implementation is terrible, but it seems that redis has pub/sub. But since unstorage does not yet support this method. I hope you can come up with something =)
pi0
changed the title
Supports multi-server synchronization
Statefull storage
Aug 6, 2024
Describe the feature
I'm glad that they started developing this library. I looked at the code and noticed that it lacks synchronization between servers. For example, pub/sub sends only within the server. For example, the ability to connect via useStorage('redis') so that it is possible to store all clients and indicate a process identifier to determine which clients are external or internal
This will reduce the number of clients on 1 server and distribute it across several clients. Or what it's called I don't remember
Additional information
The text was updated successfully, but these errors were encountered: