- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 18 for WithContext (0.07 sec)
-
okhttp-coroutines/src/test/kotlin/okhttp3/coroutines/ExecuteAsyncTest.kt
import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.job import kotlinx.coroutines.supervisorScope import kotlinx.coroutines.test.runTest import kotlinx.coroutines.withContext import kotlinx.coroutines.withTimeout import mockwebserver3.MockResponse import mockwebserver3.MockWebServer import mockwebserver3.SocketPolicy.DisconnectAfterRequest import okhttp3.Callback import okhttp3.FailingCall
Registered: 2025-05-30 11:42 - Last Modified: 2025-03-19 19:25 - 5.5K bytes - Viewed (0) -
okhttp/src/jvmTest/kotlin/okhttp3/internal/publicsuffix/PublicSuffixListGenerator.kt
} private suspend fun updateLocalFile() = withContext(Dispatchers.IO) { client.newCall(request).executeAsync().use { response -> fileSystem.sink(publicSuffixListDotDat).buffer().use { sink -> sink.writeAll(response.body.source()) } } } private suspend fun readImportResults(): ImportResults = withContext(Dispatchers.IO) {
Registered: 2025-05-30 11:42 - Last Modified: 2025-05-27 22:00 - 6.2K bytes - Viewed (0) -
build-logic/binary-compatibility/src/test/groovy/gradlebuild/binarycompatibility/PublicAPIRulesTest.groovy
given: JApiCompatibility jApiType = getProperty(jApiTypeName) def incubatingMissingRule = withContext(new IncubatingMissingRule([:])) def sinceMissingRule = withContext(new SinceAnnotationMissingRule([:])) when: jApiType.annotations >> [deprecatedAnnotation] sourceFile.text = """ @Deprecated
Registered: 2025-05-28 11:36 - Last Modified: 2023-12-01 20:12 - 16K bytes - Viewed (0) -
internal/event/target/elasticsearch.go
resp, err := c.Ping( c.Ping.WithContext(ctx), ) if err != nil { return false, store.ErrNotConnected } xhttp.DrainBody(resp.Body) return !resp.IsError(), nil } func (c *esClientV7) entryExists(ctx context.Context, index string, key string) (bool, error) { res, err := c.Exists( index, key, c.Exists.WithContext(ctx), ) if err != nil { return false, err }
Registered: 2025-05-25 19:28 - Last Modified: 2025-02-18 16:25 - 15K bytes - Viewed (0) -
internal/rest/rpc-stats.go
}, ConnectDone: func(network, addr string, err error) { if err == nil { atomic.StoreInt64(&dialEnd, time.Now().UnixNano()) } }, } return req.WithContext(httptrace.WithClientTrace(req.Context(), trace)), func() { if ds := atomic.LoadInt64(&dialStart); ds > 0 { if de := atomic.LoadInt64(&dialEnd); de == 0 { atomic.AddUint64(&globalStats.tcpDialErrs, 1)
Registered: 2025-05-25 19:28 - Last Modified: 2024-08-13 18:21 - 2.6K bytes - Viewed (0) -
okhttp-coroutines/README.md
OkHttp Coroutines ================= Support for Kotlin clients using coroutines. ```kotlin val call = client.newCall(request) call.executeAsync().use { response -> withContext(Dispatchers.IO) { println(response.body?.string()) } } ``` This is implemented using `suspendCancellableCoroutine` but uses the standard Dispatcher in OkHttp. This means that by default Kotlin's Dispatchers are not used.
Registered: 2025-05-30 11:42 - Last Modified: 2023-11-09 15:47 - 609 bytes - Viewed (0) -
gorm.go
if config.NowFunc != nil { tx.Config.NowFunc = config.NowFunc } if config.Initialized { tx = tx.getInstance() } return tx } // WithContext change current instance db's context to ctx func (db *DB) WithContext(ctx context.Context) *DB { return db.Session(&Session{Context: ctx}) } // Debug start debug mode func (db *DB) Debug() (tx *DB) { tx = db.getInstance()
Registered: 2025-05-25 09:35 - Last Modified: 2025-05-25 07:40 - 12.6K bytes - Viewed (0) -
internal/handlers/forwarder.go
outReq.ProtoMajor = 1 outReq.ProtoMinor = 1 f.rewriter.Rewrite(outReq) // Disable closeNotify when method GET for http pipelining if outReq.Method == http.MethodGet { quietReq := outReq.WithContext(context.Background()) *outReq = *quietReq } } // headerRewriter is responsible for removing hop-by-hop headers and setting forwarding headers type headerRewriter struct{}
Registered: 2025-05-25 19:28 - Last Modified: 2025-02-18 16:25 - 5.7K bytes - Viewed (0) -
tests/scopes_test.go
}).Find(&users1) if result.RowsAffected != 2 { t.Errorf("Should found two users's name in 1, 2, but got %v", result.RowsAffected) } var maxId int64 userTable := func(db *gorm.DB) *gorm.DB { return db.WithContext(context.Background()).Table("users") } if err := DB.Scopes(userTable).Select("max(id)").Scan(&maxId).Error; err != nil { t.Errorf("select max(id)") } } func TestComplexScopes(t *testing.T) {
Registered: 2025-05-25 09:35 - Last Modified: 2024-01-12 08:42 - 3.3K bytes - Viewed (0) -
tests/transaction_test.go
func TestCancelTransaction(t *testing.T) { ctx := context.Background() ctx, cancelFunc := context.WithCancel(ctx) cancelFunc() user := *GetUser("cancel_transaction", Config{}) DB.Create(&user) err := DB.WithContext(ctx).Transaction(func(tx *gorm.DB) error { var result User tx.First(&result, user.ID) return nil }) if err == nil { t.Fatalf("Transaction should get error when using cancelled context") } }
Registered: 2025-05-25 09:35 - Last Modified: 2025-05-25 07:40 - 13.3K bytes - Viewed (0)