mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 12:37:49 +00:00
Removed some dead code that does not need to exist
A consequence of the old index design, now gone Signed-off-by: quobix <dave@quobix.com>
This commit is contained in:
@@ -33,7 +33,6 @@ type RemoteFS struct {
|
|||||||
FetchChannel chan *RemoteFile
|
FetchChannel chan *RemoteFile
|
||||||
remoteErrors []error
|
remoteErrors []error
|
||||||
logger *slog.Logger
|
logger *slog.Logger
|
||||||
defaultClient *http.Client
|
|
||||||
extractedFiles map[string]RolodexFile
|
extractedFiles map[string]RolodexFile
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -246,7 +246,6 @@ func TestRemoteFS_SetRemoteHandler(t *testing.T) {
|
|||||||
assert.NoError(t, y)
|
assert.NoError(t, y)
|
||||||
assert.NotNil(t, x.RemoteHandlerFunc)
|
assert.NotNil(t, x.RemoteHandlerFunc)
|
||||||
|
|
||||||
cf = CreateClosedAPIIndexConfig()
|
|
||||||
assert.NotNil(t, x.RemoteHandlerFunc)
|
assert.NotNil(t, x.RemoteHandlerFunc)
|
||||||
|
|
||||||
x.SetRemoteHandlerFunc(h)
|
x.SetRemoteHandlerFunc(h)
|
||||||
|
|||||||
@@ -650,29 +650,8 @@ func (index *SpecIndex) GetGlobalCallbacksCount() int {
|
|||||||
|
|
||||||
// look through method for callbacks
|
// look through method for callbacks
|
||||||
callbacks, _ := yamlpath.NewPath("$..callbacks")
|
callbacks, _ := yamlpath.NewPath("$..callbacks")
|
||||||
// Channel used to receive the result from doSomething function
|
|
||||||
ch := make(chan string, 1)
|
|
||||||
|
|
||||||
// Create a context with a timeout of 5 seconds
|
|
||||||
ctxTimeout, cancel := context.WithTimeout(context.Background(), time.Millisecond*500)
|
|
||||||
defer cancel()
|
|
||||||
|
|
||||||
var res []*yaml.Node
|
var res []*yaml.Node
|
||||||
|
|
||||||
doSomething := func(ctx context.Context, ch chan<- string) {
|
|
||||||
res, _ = callbacks.Find(m.Node)
|
res, _ = callbacks.Find(m.Node)
|
||||||
ch <- m.Definition
|
|
||||||
}
|
|
||||||
|
|
||||||
// Start the doSomething function
|
|
||||||
go doSomething(ctxTimeout, ch)
|
|
||||||
|
|
||||||
select {
|
|
||||||
case <-ctxTimeout.Done():
|
|
||||||
fmt.Printf("Callback %d: Context cancelled: %v\n", m.Node.Line, ctxTimeout.Err())
|
|
||||||
case <-ch:
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(res) > 0 {
|
if len(res) > 0 {
|
||||||
for _, callback := range res[0].Content {
|
for _, callback := range res[0].Content {
|
||||||
if utils.IsNodeMap(callback) {
|
if utils.IsNodeMap(callback) {
|
||||||
|
|||||||
Reference in New Issue
Block a user