
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
github.com/z-wind/concurrencyengine
$ go get github.com/z-Wind/concurrencyengine
// set log
ELog.Start("engine.log", os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0666)
ELog.SetFlags(0)
defer ELog.Stop()
// set ctx
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
// set reqToKey for record mapping key
reqToKey := func(req Request) interface{} { return req.Item.(int) }
// create engine
e := New(ctx, 10, reqToKey)
// set simple parse function for processing request
// when ParseResult.Item is nil, you would not get the item
parseFunc := func(req Request) (ParseResult, error) {
parseResult := ParseResult{
Item: nil,
ExtraRequests: []Request{},
RedoRequests: []Request{},
Done: false,
}
n := req.Item.(int)
if n%2 == 0 {
parseResult.Done = true
parseResult.ExtraRequests = append(parseResult.ExtraRequests, Request{n + 11, req.ParseFunc})
return parseResult, nil
}
parseResult.Item = n
parseResult.Done = true
return parseResult, nil
}
// create initial requests
requests := []Request{}
for i := 0; i < 10; i++ {
requests = append(requests, Request{
Item: i,
ParseFunc: parseFunc,
})
}
// the returned result is ParseResult.Item
rspChan := e.Run(requests...)
for rsp := range rspChan {
result := rsp.(int)
e.Recorder.Done(result)
fmt.Printf("odd %d\n", result)
}
// Unordered Output:
// Initial Tasks: 10
// odd 1
// odd 11
// odd 3
// odd 13
// odd 5
// odd 15
// odd 7
// odd 17
// odd 9
// odd 19
// Finish =============================================
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.