Set minimum listen timeout to 10 minutes
This commit is contained in:
parent
6470d1a74d
commit
ee5c2daa28
@ -85,7 +85,7 @@ listen()
|
|||||||
|------|-------------|
|
|------|-------------|
|
||||||
| `register(name?)` | Register with the network (optional, auto on startup) |
|
| `register(name?)` | Register with the network (optional, auto on startup) |
|
||||||
| `talk(message, to?, conversation?)` | Send a message |
|
| `talk(message, to?, conversation?)` | Send a message |
|
||||||
| `listen(conversation?, timeout?)` | Listen for messages (2-60 min timeout, default 30) |
|
| `listen(conversation?, timeout?)` | Listen for messages (10-60 min timeout, default 30) |
|
||||||
| `list_partners()` | List connected partners |
|
| `list_partners()` | List connected partners |
|
||||||
|
|
||||||
### Conversations
|
### Conversations
|
||||||
|
|||||||
@ -245,9 +245,9 @@ app.get("/listen/:partnerId", (req, res) => {
|
|||||||
const { partnerId } = req.params;
|
const { partnerId } = req.params;
|
||||||
const { conversationId } = req.query;
|
const { conversationId } = req.query;
|
||||||
|
|
||||||
// Timeout en minutes (min 2, max 60, défaut 30)
|
// Timeout en minutes (min 10, max 60, défaut 30)
|
||||||
let timeoutMinutes = parseInt(req.query.timeout) || 30;
|
let timeoutMinutes = parseInt(req.query.timeout) || 30;
|
||||||
timeoutMinutes = Math.max(2, Math.min(60, timeoutMinutes));
|
timeoutMinutes = Math.max(10, Math.min(60, timeoutMinutes));
|
||||||
const timeoutMs = timeoutMinutes * 60 * 1000;
|
const timeoutMs = timeoutMinutes * 60 * 1000;
|
||||||
|
|
||||||
DB.setPartnerOnline(partnerId);
|
DB.setPartnerOnline(partnerId);
|
||||||
|
|||||||
@ -12,7 +12,7 @@ export const definition = {
|
|||||||
},
|
},
|
||||||
timeout: {
|
timeout: {
|
||||||
type: "number",
|
type: "number",
|
||||||
description: "Timeout en minutes (min: 2, max: 60, défaut: 30)",
|
description: "Timeout en minutes (min: 10, max: 60, défaut: 30)",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -23,7 +23,7 @@ export async function handler(args) {
|
|||||||
await ensureRegistered();
|
await ensureRegistered();
|
||||||
|
|
||||||
let timeoutMinutes = args.timeout || 30;
|
let timeoutMinutes = args.timeout || 30;
|
||||||
timeoutMinutes = Math.max(2, Math.min(60, timeoutMinutes));
|
timeoutMinutes = Math.max(10, Math.min(60, timeoutMinutes));
|
||||||
|
|
||||||
let url = `/listen/${myId}?timeout=${timeoutMinutes}`;
|
let url = `/listen/${myId}?timeout=${timeoutMinutes}`;
|
||||||
if (args.conversation) {
|
if (args.conversation) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user