Comments (4)
Another temporary fix is to delete the server that BOB is currently in and make a new one.
For development, disable any role creation call if the role is already created.
from yet-another-better-office-hour-bot.
The Promise.race()
fix is at catch-role-creation-fail
branch.
If we need to catch timeout everywhere, here's the decorator solution:
function timeoutable(timeoutAfter: number, errMsg: string) {
return (_t: unknown,
_p: string,
descriptor: PropertyDescriptor) => {
const promiseToRace = descriptor.value;
let timeoutHandle: NodeJS.Timeout;
descriptor.value = function (this: any) {
return Promise.race([
// eslint-disable-next-line prefer-rest-params
promiseToRace?.call(this, arguments),
new Promise<never>(
(_, reject) => {
timeoutHandle = setTimeout(() =>
reject(new Error(errMsg)),
timeoutAfter);
}
).finally(() => {
clearTimeout(timeoutHandle);
console.log('timeout cleared');
})
]);
};
};
}
Usage:
class SomeClass {
// force reject after 5 seconds
@timeoutable(5000, "Method timed out.")
async methodThatCanTakeForever() {
// ...
}
}
from yet-another-better-office-hour-bot.
Might be related to this issue, maybe not. But I think the "Ensure roles exist" function itself can be avoided being called unnecessarily every time the bot needs to check if a user has a role. Instead, we should do something similar to how we process the queue messages and store the role id (or object) in an AttendingServer class member and then use that whenever doing a role check. We should only worry about if the roles exist when starting the server and when a role is deleted
edit: also store the role ids in firebase
from yet-another-better-office-hour-bot.
The issue doesn't seem to show up any more. I think we can safely ignore it for now
from yet-another-better-office-hour-bot.
Related Issues (20)
- Display the help message for a student when helper does `/next` HOT 1
- Use TZ Format for time zones
- Update to TS 5.0 HOT 1
- Queue display doesn't update when a queued student leaves the server
- Backup helper ids
- Use a data access object (DAO) to abstract away raw firebase method access HOT 1
- Use logging framework and remove all console logs
- Google sheet permission error is never caught HOT 1
- Use reacord to manage state in embeds HOT 1
- `/quick_start` support for extensions
- Update to TS5.0 Decorators
- Accommodate Other Office Hours Formats HOT 2
- Open-floor Office Hours Support HOT 2
- `/start` Open Specific Queues HOT 1
- Make Tracking Optional HOT 2
- Synchronize queue object with channel object HOT 2
- Use Private Threads to send links if they are available to use HOT 1
- `/assign_helper_roles` sometimes thinks that members aren't in the server HOT 2
- Consistent emoji style in embed buttons HOT 1
- Better tutoring timesheet implementation HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yet-another-better-office-hour-bot.