MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / asyncSQL

Function asyncSQL

IceFireDB-SQLite/internal/sqlite/db.go:162–181  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

160}
161
162func asyncSQL(ctx context.Context) {
163 utils.GoWithRecover(func() {
164 for {
165 select {
166 case <-ctx.Done():
167 return
168 case s := <-p2pPubSub.Inbound:
169 _, err := db.Exec(s.Message)
170 if err != nil {
171 logrus.Infof("Inbound sql: %s err: %v", s, err)
172 continue
173 }
174 logrus.Infof("Inbound sql: %s", s.Message)
175 }
176 }
177 }, func(r any) {
178 time.Sleep(time.Second)
179 asyncSQL(ctx)
180 })
181}
182
183func getTableName(sql string) string {
184 s := strings.ToLower(sql)

Callers 1

InitSQLiteFunction · 0.70

Calls 2

GoWithRecoverFunction · 0.92
DoneMethod · 0.80

Tested by

no test coverage detected