Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for WithContext (0.27 sec)

  1. okhttp-coroutines/src/test/kotlin/okhttp3/SuspendCallTest.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.HttpUrl.Companion.toHttpUrl
    Plain Text
    - Registered: Fri Apr 12 11:42:09 GMT 2024
    - Last Modified: Fri Apr 05 11:25:23 GMT 2024
    - 5.3K bytes
    - Viewed (0)
  2. 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
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 5.4K bytes
    - Viewed (0)
  3. okhttp/src/test/java/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) {
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Apr 18 01:24:38 GMT 2024
    - 6K bytes
    - Viewed (0)
  4. 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)
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Thu Sep 29 16:27:58 GMT 2022
    - 2.3K bytes
    - Viewed (0)
  5. 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.
    
    Plain Text
    - Registered: Fri May 03 11:42:14 GMT 2024
    - Last Modified: Thu Nov 09 15:47:27 GMT 2023
    - 609 bytes
    - Viewed (0)
  6. tests/prepared_stmt_test.go

    		t.Fatalf("should assign PreparedStatement Manager back to database when using PrepareStmt mode")
    	}
    
    	ctx, cancel := context.WithTimeout(context.Background(), 500*time.Millisecond)
    	defer cancel()
    	txCtx := tx.WithContext(ctx)
    
    	user := *GetUser("prepared_stmt", Config{})
    
    	txCtx.Create(&user)
    
    	var result1 User
    	if err := txCtx.Find(&result1, user.ID).Error; err != nil {
    		t.Fatalf("no error should happen but got %v", err)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  7. 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) {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  8. cmd/http-tracer.go

    		tc := mcontext.TraceCtxt{
    			AmzReqID:         w.Header().Get(xhttp.AmzRequestID),
    			RequestRecorder:  reqRecorder,
    			ResponseRecorder: respRecorder,
    		}
    
    		r = r.WithContext(context.WithValue(r.Context(), mcontext.ContextTraceKey, &tc))
    
    		reqStartTime := time.Now().UTC()
    		h.ServeHTTP(respRecorder, r)
    		reqEndTime := time.Now().UTC()
    
    Go
    - Registered: Sun Apr 28 19:28:10 GMT 2024
    - Last Modified: Tue Nov 21 01:09:35 GMT 2023
    - 5.9K bytes
    - Viewed (0)
  9. 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{}
    
    Go
    - Registered: Sun Apr 21 19:28:08 GMT 2024
    - Last Modified: Fri Apr 07 05:42:10 GMT 2023
    - 5.6K bytes
    - Viewed (0)
Back to top