Skip to content
This repository has been archived by the owner on Jul 31, 2024. It is now read-only.

GetService infinite yield #202

Closed
CaptinLetus opened this issue Mar 18, 2022 · 6 comments
Closed

GetService infinite yield #202

CaptinLetus opened this issue Mar 18, 2022 · 6 comments
Assignees

Comments

@CaptinLetus
Copy link

If you call GetService/GetController on a service/controller that does not exist, I believe the current functionality is to yield until that service/controller exists

It would be nice if, after 5-10 seconds, we got a warning like Possible infinite yield while getting service "Name"

Without this message, the developer gets no indication that there might be an issue

@Sleitnick Sleitnick self-assigned this Mar 18, 2022
@Sleitnick
Copy link
Owner

Looks like this is related to the Comm module:

The only yield would be GetService from the client. The first yield is waiting for the Services folder, which uses WaitForChild without an explicit timeout, which should give the expected infinite yield warning.

It then calls ClientComm.new, which has a WaitForChild that does have an explicit timeout (set to 60 seconds). If the WaitForChild times out (returns nil), then an error is thrown that the folder could not be found.

I see three possible solutions to this, and I favor the last one:

  1. Reduce the default timeout waiting for the comm folder
  2. Remove the timeout waiting for the comm folder (thus giving the desired warning)
  3. Add an attribute on the Services folder which communicates to the client what services will be available (just a comma-separated list of service names). Then throw an error immediately if the service is certainly not going to be available.

@CaptinLetus
Copy link
Author

I agree, the third one seems like the best solution

@CaptinLetus
Copy link
Author

That method might have issues if someone added a comma to their service name

@Sleitnick
Copy link
Owner

True, which I feel like is a "why would you do that" sort of thing, but probably worth encoding the name perhaps. Similar to URL encoding. Easy to do and would make sure the delimiter is captured properly.

@ImFarley
Copy link

Hi - I've been using Knit for about 3 years now and last night I had this occur for probably the 3rd or 4th time. I renamed a service that I was using in one of my controllers and could not for the life of me figure out why KnitStart was no longer firing on the client. There was much profanity followed by me shutting down the computer for the night.

Was just wondering if you ever landed somewhere on this issue? Of course it's largely user error and you'd think after doing it several times I'd like... stop... but I thought I'd whine about it anyways. Thanks.

@Sleitnick
Copy link
Owner

#248

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants