Skip to content

Commit

Permalink
fix: favorite
Browse files Browse the repository at this point in the history
  • Loading branch information
liaosunny123 committed Sep 2, 2023
1 parent fcee5d2 commit fe2de65
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 16 deletions.
6 changes: 3 additions & 3 deletions .env.docker.compose
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
CONSUL_ADDR=consul:8500
CONSUL_ANONYMITY_NAME=paraparty.
# Configure logger level, support: DEBUG, INFO, WARN (WARNING), ERROR, FATAL
LOGGER_LEVEL=DEBUG
LOGGER_LEVEL=INFO
# Cofigure logger integrated with otel, support: enable, disable
# If this setting is enable, you will see log in the OTEL Export with possible runtime waste
LOGGER_OUT_TRACING=enable
Expand Down Expand Up @@ -44,14 +44,14 @@ REDIS_MASTER=
# Config state, if use `disable` the sampler will be closed. use `enable` to enable
TRACING_STATE=enable
# Config tracing sampler, suggest 0.01
TRACING_SAMPLER=1
TRACING_SAMPLER=0.01
TRACING_ENDPOINT=jaeger:4318
# Optional: Config Pyroscope
# Decide whether to enable the service, support : enable, disable.
# If you enable this service, you must provide Pyroscope server environment
# This profiling is ONLY designed for DEBUGGING
# SO, PLEASE DO NOT ENABLE THIS SERVICE IN YOUR PRODUCTION ENVIRONMENT, OR IT MAY TAKE MUCH RUNTIME COST.
PYROSCOPE_STATE=enable
PYROSCOPE_STATE=disbale
PYROSCOPE_ADDR=http://pyroscope:4040/
# Configure RabbitMQ
# Optional: `RABBITMQ_VHOST_PREFIX`: If you provide this config, the service will use value as the rabbit mq vhost prefix.
Expand Down
4 changes: 2 additions & 2 deletions src/services/relation/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ func (r RelationServiceImpl) GetFollowList(ctx context.Context, request *relatio
}
}

rFollowList, err := r.idList2UserList(ctx, followIdListInt, request.UserId, logger, span)
rFollowList, err := r.idList2UserList(ctx, followIdListInt, request.ActorId, logger, span)
if err != nil {
resp = &relation.FollowListResponse{
StatusCode: strings.UnableToGetFollowListErrorCode,
Expand Down Expand Up @@ -917,7 +917,7 @@ func (r RelationServiceImpl) GetFollowerList(ctx context.Context, request *relat
}
}

rFollowerList, err := r.idList2UserList(ctx, followerIdListInt, request.UserId, logger, span)
rFollowerList, err := r.idList2UserList(ctx, followerIdListInt, request.ActorId, logger, span)
if err != nil {
resp = &relation.FollowerListResponse{
StatusCode: strings.UnableToGetFollowerListErrorCode,
Expand Down
28 changes: 28 additions & 0 deletions test/k6/favorite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { sleep, check } from 'k6';
import http from 'k6/http';

export const options = {
scenarios: {
Scenario_1: {
executor: 'ramping-vus',
gracefulStop: '30s',
stages: [
{ target: 1000, duration: '15s' },
{ target: 1500, duration: '30s' },
{ target: 1000, duration: '15s' },
],
gracefulRampDown: '30s',
exec: 'favorite',
},
},
}

export function favorite() {
let res = http.post('http://127.0.0.1:37000/douyin/favorite/action/?token=e75fae76-6a4e-4fa8-9b60-230e5d4f6b29&video_id=3048003698&action_type=1')

let jsonResponse = JSON.parse(res.body);
check(jsonResponse, {
'status_code is 0': (json) => json.status_code === 10008,
});
sleep(3)
}
11 changes: 6 additions & 5 deletions test/k6/login.js → test/k6/favorite_random.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { sleep } from 'k6'
import http from 'k6/http'
import { sleep, check } from 'k6';
import http from 'k6/http';

export const options = {
scenarios: {
Expand All @@ -12,13 +12,14 @@ export const options = {
{ target: 1000, duration: '15s' },
],
gracefulRampDown: '30s',
exec: 'login',
exec: 'favorite',
},
},
}

export function login() {
http.post('http://localhost:37000/douyin/user/login?username=epicmo&password=epicmo')
export function favorite() {
let actionType = Math.random() < 0.5 ? 1 : 2;
let res = http.post(`http://127.0.0.1:37000/douyin/favorite/action/?token=e75fae76-6a4e-4fa8-9b60-230e5d4f6b29&video_id=3048003698&action_type=${actionType}`)

sleep(3)
}
20 changes: 14 additions & 6 deletions test/k6/feed.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
import { sleep } from 'k6'
import http from 'k6/http'
import { sleep, check } from 'k6';
import http from 'k6/http';

export const options = {
scenarios: {
Scenario_1: {
feed: {
executor: 'ramping-vus',
startVUs: 0,
gracefulStop: '30s',
stages: [
{ target: 1000, duration: '60s' },
{ target: 1000, duration: '20s' },
{ target: 2000, duration: '20s' },
{ target: 1000, duration: '20s' },
],
gracefulRampDown: '30s',
exec: 'feed',
Expand All @@ -16,7 +19,12 @@ export const options = {
}

export function feed() {
http.get('https://gugotik.endymx.qzwxsaedc.cn/douyin/feed?')
let res = http.get('http://127.0.0.1:37000/douyin/feed?');

sleep(3)
let jsonResponse = JSON.parse(res.body);
check(jsonResponse, {
'status_code is 0': (json) => json.status_code === 0,
});

sleep(3);
}

0 comments on commit fe2de65

Please sign in to comment.