@@ -167,14 +167,38 @@ run(get_pb, KeyGen, _ValueGen, State) ->
167167 {error , Reason , State }
168168 end ;
169169
170+ run (alwaysget_http , _KeyGen , _ValueGen , State ) ->
171+ Host = inet_parse :ntoa (State # state .http_host ),
172+ Port = State # state .http_port ,
173+ Bucket = State # state .recordBucket ,
174+ AGKC = State # state .alwaysget_key_count ,
175+ case AGKC > State # state .alwaysget_perworker_minkeycount of
176+ true ->
177+ KeyInt = eightytwenty_keycount (AGKC ),
178+ Key = generate_uniquekey (KeyInt , State # state .rand_keyid ,
179+ State # state .alwaysget_keyorder ),
180+ URL =
181+ io_lib :format (" http://~s :~p /buckets/~s /keys/~s " ,
182+ [Host , Port , Bucket , Key ]),
183+
184+ case get_existing (URL , State # state .http_timeout ) of
185+ ok ->
186+ {ok , State };
187+ {error , Reason } ->
188+ % not_found is not OK
189+ {error , Reason , State }
190+ end ;
191+ false ->
192+ {silent , State }
193+ end ;
194+
170195run (alwaysget_pb , _KeyGen , _ValueGen , State ) ->
171196 % Get one of the objects with unique keys
172197 Pid = State # state .pb_pid ,
173198 Bucket = State # state .recordBucket ,
174199 AGKC = State # state .alwaysget_key_count ,
175200 case AGKC > State # state .alwaysget_perworker_minkeycount of
176201 true ->
177-
178202 KeyInt = eightytwenty_keycount (AGKC ),
179203 Key = generate_uniquekey (KeyInt , State # state .rand_keyid ,
180204 State # state .alwaysget_keyorder ),
@@ -505,6 +529,14 @@ json_get(Url, Timeout, UsePool) ->
505529 {error , Other }
506530 end .
507531
532+ get_existing (Url , Timeout ) ->
533+ case ibrowse :send_req (lists :flatten (Url ), [], get , [], [], Timeout ) of
534+ {ok , " 200" , _ , _Body } ->
535+ ok ;
536+ Other ->
537+ {error , Other }
538+ end .
539+
508540
509541to_binary (B ) when is_binary (B ) ->
510542 B ;
0 commit comments